Given an array of integers A, return the largest integer that only occurs once. If no integer occurs once, return -1. Example 1: Input: Output: 8 Explanation: The maximum …
Given an array of integers and a target value, find the number of distinct pairs that sum to the target. The pairs (x,y) and (x’, y’) where x smaller …
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 …
You are given coins of different denominations and a total amount of money. Write a function to compute the number of combinations that make up that amount. You may …
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 …