Yahoo India Web Search

Search results

  1. Back to Explore Page. Given an array of integers and a sum B, find all unique combinations in the array where the sum is equal to B. The same number may be chosen from the array any number of times to make B.Note:        1. All numbers wil.

  2. 3 Sum Solution 1: Brute Force. A simple solution is to use three nested loops and check for each possible combination if their sum is zero. To avoid duplicate answers, we need to hash the triplet and store it in a set. An easy way to hash a triplet is by converting it to a string. Extra space needed will be the number of unique triplets that ...

  3. Given an array, the task is to find the maximum triplet sum in the array. Example 1: Input : arr[ ] = {4, 2, 7, 9} Output : 20 Explanation: Here are total 4 ...

  4. Armstrong Numbers. You are given a 3-digit number n, Find whether it is an Armstrong number or not. An Armstrong number of three digits is a number such that the sum of the cubes of its digits is equal to the number itself. 371 is an Armstrong number since 33 + 73 + 13 = 371. Note: Return "true" if it is an Armstrong number else return "false".

  5. Back to Explore Page. Given a weighted, undirected, and connected graph with V vertices and E edges, your task is to find the sum of the weights of the edges in the Minimum Spanning Tree (MST) of the graph. The graph is represented by an adjacency list, where each element.

  6. Interview Preparation. Menu. Back to Explore Page. Find all valid combinations of K numbers that sum upto to N such that the following conditions are true:Only number 1 through 9 are used.Each number is used atmost once.Return the list of all possible valid combinations.Note: The list.

  7. Example 1: N = 5. Output: There are 5 ways to assign symbols to. make the sum of nums be target 3. Example 2: N = 1. Output: The task is to complete the function findTargetSumWays() which finds and returns the number of different expressions that can be built with modulo 109 + 7.