Category: Uncategorized
-
Grokking 75:Pair with Target Sum
Problem Statement Given an array of numbers sorted in ascending order and a target sum, find a pair in the array whose sum is equal to the given target. If no such pair exists return [-1, -1]. Write a function to return the indices of the two numbers (i.e. the pair) such that they add up…
-
Grokking 75: Kids With the Greatest Number of Candies
Kids With the Greatest Number of Candies Problem Statement There are n kids with candies. You are given a candies array containing integers, where candies[i] denotes the number of candies the ith kid has, and an integer extraCandies, represents the number of extra candies that you have. Return a boolean array result of length n, where result[i] is true if, after giving all the extraCandies to the ith kid, he/she will…