# Archive for June 2017

Problem statement Given an array of distinct elements find all triplets in array whose sum is equal to . Sample input

Sample output

Solution We will solve this algorithm in time using hashing. The first iteration will be over all elements of our array. Let that elements be . . . Read more

Problem statement Given a string, find the length of the longest substring without repeating characters. Examples Example 1 Given abcabcbb, the answer is abc, which the length is . Example 2 Given bbbbb, the answer is b, with the length of . Example 3 Given pwwkew, the answer is wke, . . . Read more

Problem statement Marc loves cupcakes, but he also likes to stay fit. He eats cupcakes in one sitting, and each cupcake has a calorie count, . After eating a cupcake with calories, he must walk at least (where is the number cupcakes he has already eaten) miles to maintain his . . . Read more