Category: math
Given a 32-bit integer, we want to find out the next highest power of 2. For example, the next power of two for 127 is 128. We can use …
We can compute the Greatest Common Divisor (GCD) using Iterative Divide/Remainder Method. The following is the GCD implementation in BASH Programming: #!/bin/bash function gcd() { local x=$1 local y=$2 …
Teaching Kids Programming: Videos on Data Structures and Algorithms You are given integers n, a and b. You are standing in a line of n people. You don’t know …
Teaching Kids Programming: Videos on Data Structures and Algorithms Given a square matrix mat, return the sum of the matrix diagonals. Only include the sum of all the elements …
Teaching Kids Programming: Videos on Data Structures and Algorithms You are given a lists of non-negative integers nums. Sort the list in ascending order by the number of 1s …