Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
1 vote
2 answers
5k views

Reversing the bits of a 32-bit integer

Here is my code: ...
katty's user avatar
  • 615
7 votes
3 answers
3k views

Finding the fastest common prefix of 2 strings in Python

I'm comparing my algorithms, slice_prefix and bit_prefix, with existing ones to find the common prefix length of 2 strings as ...
12345678910111213's user avatar
3 votes
1 answer
320 views

A bitwise common prefix algorithm in Python

Is my algorithm slow because it has problems? Or, is any bitwise common prefix solution not going to give me the performance I'm looking for? After profiling my algorithm, I found that over 60% of ...
12345678910111213's user avatar
1 vote
1 answer
6k views

"Flipping bits" Python implementation

Problem Statement You will be given a list of 32 bits unsigned integers. You are required to output the list of the unsigned integers you get by flipping bits in its binary representation (i.e. ...
CodeYogi's user avatar
  • 5,209
2 votes
3 answers
333 views

Performing add/delete/count operations on a list

Problem Statement (HackerRank) You have a list of integers, initially the list is empty. You have to process Q operations of three kinds: add s: Add integer s to your list, note that ...
darthShadow's user avatar
6 votes
1 answer
20k views

XOR of a list of a numbers

In preparing a solution for the CodeChef "Will India Win" challenge, I am trying to find out the xor of list of numbers. The first line of input contains the number of test cases, 1 ≤ T ≤ 106. ...
Anupam's user avatar
  • 185