All Questions
6 questions
4
votes
2
answers
378
views
Find out whether number is of Power of Two
The task
is taken from leetcode
Given an integer, write a function to determine if it is a power of
two.
Example 1:
Input: 1
Output: true
Explanation: 20 = 1
Example 2:
...
3
votes
1
answer
439
views
Division without using division, multiplication, or modulus operators
The task
Implement division of two positive integers without using the
division, multiplication, or modulus operators. Return the quotient as
an integer, ignoring the remainder.
My solution
<...
3
votes
1
answer
7k
views
Hackerrank "Strings: Making Anagrams" Javascript Solution
This is the original problem :
Input Format
The first line contains a single string, a. The second line contains a
single string, b.
Constraints
1<= |a|,|b| <= 10^4
It ...
3
votes
2
answers
1k
views
Codility “PermMissingElem” Solution
This is my solution to the PermMissingElem problem, I wonder what can be improved? Expected worst case time complexity is O(N), but the performance test shows that it's O(N) or O(N * log(N)), which I ...
6
votes
2
answers
5k
views
Codility binary gap solution
This is how I solved the binary gap problem: Find longest sequence of zeros, bounded by ones, in binary representation of an integer
I wonder how does it fare against solutions such as ones appeared ...
12
votes
3
answers
6k
views
Codility binary gap solution using regex
Below is the code I implemented to solve the binary gap problem:
Find longest sequence of zeros, bounded by ones, in binary representation of an integer.
However, it seems to be different from the ...