Implement a function countBy(array, iteratee) that generates an object with keys derived from the results of applying each element of the array to the iteratee function, where the values correspond to the frequency of each key returned by the iteratee, with iteratees supporting both functions and strings as properties.
MEDIUM
topological-sort
Topological Sort
Implement a function that performs a topological sort on a directed graph (in adjacency list format), where the keys represent nodes and values are an array of nodes that have an outgoing edge to the current node.
MEDIUM
calculate-days
Calculate Days Between Dates
Write a function which accepts two valid dates and returns the difference between them in number of days.
MEDIUM
random-hex-color
Generate Random HEX Color Code
Write a function which returns a random HEX color code.
MEDIUM
count-between-x
Count Characters between First and Last 'X'
Write a function that returns the count of characters between the first and last 'X' in a string.
MEDIUM
convert-to-24hr-format
Convert Time to 24-Hour Format
Write a function to convert the time input given in a 12-hour format to a 24-hour format.
MEDIUM
reverse-string-words
Reverse String by Words
Write a program to reverse a string by words and show the reverse of each word in place.
MEDIUM
reverse-string
Reverse a String
Write a program to reverse a string using different approaches.
MEDIUM
random-number-generator
Random Number Generator in Range
Create a function that returns a random number in the given range of values, both inclusive.
MEDIUM
check-integer
Check if Number is Integer
Write a function that returns true if the given value is an integer without using any inbuilt functions.
MEDIUM
swap-integers
Swap Integers without Temporary Variable
Write a function that swaps the values of two integers stored in variables num1 and num2, without using a temporary variable.
EASY
topological-sorting
Topological Sorting
Given a directed acyclic graph (DAG), perform a topological sort and return the linear ordering of vertices that respects the partial order.
MEDIUM
knapsack-problem
Knapsack Problem
Given a set of items, each with a weight and a value, determine the maximum value that can be obtained by selecting a subset of the items that fit into a knapsack of limited capacity.
HARD
fibonacci-sequence
Fibonacci Sequence
Generate the first n numbers in the Fibonacci sequence. Each number is the sum of the two preceding ones, starting from 0 and 1.
EASY
reverse-integer
Reverse Integer
Given a 32-bit signed integer, reverse it and return the reversed number. If the reversed number overflows, return 0.