Posts

Showing posts with the label uber

Number of stickers of source string to make target string

https://leetcode.com/discuss/interview-question/418351/uber-internship-no-offer Uber used to call Ubercab, and they have a lot of "ubercab" stickers and assuming you can cut them into individual characters. You are now given a word in string, and return how many stickers you need to make the word --- Intuition Generic solution given source and target words Pre process => source chars freq, and target  chars  freq in HashMap's Ignore spaces in both source, and target for each char in target     ans = Math.max(ans, (int)Math.ceil(target freq * 1.0 / source freq)) --- Time - O(m + n) Space - O(1) = Character set size --- ---