Skip to main content

All 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: ...
thadeuszlay's user avatar
  • 3,981
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 <...
thadeuszlay's user avatar
  • 3,981
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 ...
kdenz's user avatar
  • 335
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 ...
kdenz's user avatar
  • 335
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 ...
kdenz's user avatar
  • 335
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 ...
Such Much Code's user avatar