This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//||||Hola chicos{HEllo GUYS}, many students requested me to contribute this code. Here is your solution:)|||| | |
//I have used STL and created the program using Pure Object Oriented Paradigm. | |
// This code tried to solve the problem considering TIME_COMPLEXITY. | |
// The algorithm and schema can be improved though. | |
// https://vitspot.com/code/amount-remaining-after-shopping/ | |
// Else go to bottom of file, to read the whole question. | |
#include<iostream> | |
#include<string> | |
#include<tuple> | |
#include<vector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
No Change | |
Vikram’s mom gave him a certain amount of money and asked him to get change for the money in coins. | |
She also told the denominations of coin she wanted and also told the total number of coins must be minimum. | |
If that amount of money cannot be made up by any combination of the coins, print -1. | |
Example1:- | |
Let the Amount – 11 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
We have a collection of potatoes, each potato has a positive integer weight. | |
Each turn, we choose the two heaviest potatoes and smash them together. Suppose the potatoes have weights x and y with x <= y. The result of this smash is: | |
If x = = y, both potatoes are totally destroyed; | |
If x ! = y, the potato of weight x is totally destroyed, and the potato of weight y has new weight y-x. | |
At the end, there is at most 1 potato left. Return the weight of this potato (or 0 if there are no potatoes left.) | |
Example:- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Point to Point | |
Shyam is standing in Point A. He has to reach Point B. There are m number of divisions | |
between Point A and point B. | |
These division may or may not have a stone. One can jump only on the stone. | |
Given a list of stones positions (in division) in sorted ascending order, | |
determine whether Shyam can reach Point B. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Change the word | |
You’ll be given with two words.You have to convert the first word to second with minimal number of operation. | |
You can add or delete or replace a character to word1.Find the minimal number of operation. | |
Example:- | |
Input: word1 = "intention", word2 = "execution" | |
Output: 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Triplet Sum | |
Given an array of numbers find unique triplets such that the sum of the triplets is zero. | |
The solution set must not contain duplicate triplets.Find the number of such triplets in the array | |
Example:- | |
Given array nums = [-1, 0, 1, 2, -1, -4], | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Water and Jugs | |
You are given two jugs with capacities x and y litres. There is an infinite amount of water supply available. You need to determine whether it is possible to measure exactly z litres using these two jugs. | |
If z liters of water is measurable, you must have z liters of water contained within one or both buckets by the end. | |
Operations allowed: | |
Fill any of the jugs completely with water. | |
Empty any of the jugs. |