Given a set of characters and their corresponding frequencies of occurrence, produce Huffman codes for each character such that the average code length is minimised. Return the average code length.
ReadGiven an array with n objects colored red, white, or blue, sort them in-place in a single pass. Objects of the same color should be adjacent to each other and the sorted colors should be in the order of red, white, and blue.
ReadDesign a matrix-like data structure that allows you to update elements and query submatrix sums efficiently.
ReadDesign an array-like data structure that allows you to update elements and query subarray sums efficiently.
ReadGiven an array of numbers A and a key k, find the length of the longest subarray whose sum is less than or equal to k.
ReadYou are given an integer array A and you have to return a new counts array. The counts array has the property where counts[i] is the number of smaller elements to the right of A[i].
ReadSuppose you are given a 2D matrix representing exchange rates between currencies. You want to determine if arbitrage exists in the market (i.e. if there is a way to start with a single unit of some currency C and convert it back to more than one unit of C through a sequence of exchanges).
ReadGiven an input string s and a pattern p, implement regular expression matching with support for '.' and '*'.
Read