Tag: c++
Design and implement a TwoSum class. It should support the following operations: add and find. add – Add the number to an internal data structure. find – Find if …
There is a fence with n posts, each post can be painted with one of the k colors. You have to paint all the posts such that no more …
Given an unsorted array return whether an increasing subsequence of length 3 exists or not in the array. Formally the function should: Return true if there exists i, j, …
Given an array nums of n integers and an integer target, find three integers in nums such that the sum is closest to target. Return the sum of the …
Numbers can be regarded as product of its factors. For example, 8 = 2 x 2 x 2; = 2 x 4. Write a function that takes an integer …