Skip to main content

All Questions

Tagged with
7 votes
1 answer
3k views

Sort int array by frequency then value

Problem Take an array of ints as input and run a special sorting algorithm on it. This algorithm must first sort by int frequency, less frequent first, then sort by value. For example ...
greg's user avatar
  • 1,017
5 votes
1 answer
245 views

Finding added keys, removed keys, and unchanged keys in ordereddict

I'm comparing two OrderedDict objects and I need to find added keys, removed keys, and keys that are present in both (the intersection). Sets are designed for ...
Conor Mancone's user avatar
2 votes
3 answers
1k views

Sorting a list by the modulus of 3

The input is an unsorted array of integers. The output should be an array of integers sorted based on the modulus of 3 (or any other number). It begins with all integers conforming to Integer % 3 == ...
Neelesh Salian's user avatar
4 votes
4 answers
181 views

Increase performance of a method which finds the element removed from an array

Imagine that you have a TreeSet of numbers, and you copy them into an array, but you remove one element of it. You want to know the element removed. ...
Manuelarte's user avatar