Given a list of numbers and a number k, return whether any two numbers from the list add up to k

This question can be easily solved with the help of set in O(N) time and space complexity.First add all the elements of array into set and then traverse each element of array and check whether K-ar[i] is present in set or not. Here is the code in java with O(N) complexity : boolean flag=false; HashSet<Long> … Read more

Difference between subarray, subset & subsequence

Consider an array: {1,2,3,4} Subarray: contiguous sequence in an array i.e. {1,2},{1,2,3} Subsequence: Need not to be contiguous, but maintains order i.e. {1,2,4} Subset: Same as subsequence except it has empty set i.e. {1,3},{} Given an array/sequence of size n, possible Subarray = n*(n+1)/2 Subseqeunce = (2^n) -1 (non-empty subsequences) Subset = 2^n

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)