Skip to content

Instantly share code, notes, and snippets.

@bhalash
Last active October 18, 2017 09:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bhalash/a8d93592c4ecefbbcec789f43728f8a2 to your computer and use it in GitHub Desktop.
Save bhalash/a8d93592c4ecefbbcec789f43728f8a2 to your computer and use it in GitHub Desktop.
Fiendishly-Difficult Candidate Questions (Muahahahahaha)

Problem 1

Reverse all characters in a string.

'Bob Ate Fresh Gummy Karate Monkeys' => 'syeknoM etaraK ymmuG hserF etA boB'

Problem 2

Reverse only the order of words in a string.

'Bob Ate Fresh Gummy Karate Monkeys' => 'Monkeys Karate Gummy Fresh Ate Bob'

Problem 3

Find the maximum value in a list of numbers.

[1, 1, 7,  2, 3, 4, 4, 4, 5, 5] => 7

Problem 4

Find the minimum value in a list of numbers.

[1, 1, 2, 3, 4, 4, 4, -9, 5, 5] => -9

Problem 5

Calculate the actual remainder of a division, given a numerator and denominator, without using the modulo (%) operator or equivalent function.

25 % 10 = 5

Problem 6

Return only unique/distinct values from a list of numbers.

[1, 1, 2, 3, 4, 4, 4, 5, 5] => [1, 2, 3, 4, 5]

Problem 7

Return the distinct values from a list of numbers as a string, joined with the count of occurrences.

[1, 1, 2, 3, 4, 4, 4, 5, 5] => '1(2) 2(1) 3(1) 4(3) 5(2)'

Problem 8

Given a string of expressions (variable assignments and operators) only, and which adheres to the below format, evalute and return the results of the expressions.

'a=9 b=1 c=5 d=2 e=9 a / -b + c * d % e' => -8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment