My code is giving 5 but the correct solution is 6 the elements popped out in series are 19,9,8,11,17,1įirst three elements from stack A & then from Stack B. Click the answer to find similar crossword clues. Enter the length or pattern for better results. The Crossword Solver finds answers to classic crosswords and cryptic crossword puzzles. It works fine for some of the test cases but fails for rest like for the below input 1ġ9 9 8 13 1 7 18 0 19 19 10 5 15 19 0 0 16 12 5 10 - Stack Aġ1 17 1 18 14 12 9 18 14 3 4 13 4 12 6 5 12 16 5 11 16 8 16 3 7 8 3 3 0 1 13 4 10 7 14 - Stack B The Crossword Solver found 30 answers to 'Stack of cards', 4 letters crossword clue. Sample Input 0īelow is my code I tried the greedy approach by taking the minimum element from the top of the stack & adding it to the sum. Nick's final score is the total number of integers he has removed from the two stacks.įind the maximum possible score Nick can achieve (i.e., the maximum number of integers he can remove without being disqualified) during each game and print it on a new line.įor each of the games, print an integer on a new line denoting the maximum possible score Nick can achieve without being disqualified. Nick is disqualified from the game if, at any point, his running sum becomes greater than some integer X given at the beginning of the game. Nick keeps a running sum of the integers he removes from the two stacks. In each move, Nick can remove one integer from the top of either stack A or B stack. Two stacks of blank business cards of different heights on white. Alexa challenges Nick to play the following game: Find Two Stacks stock images in HD and millions of other royalty-free stock photos. I just attempted a stack based problem on HackerRankĪlexa has two stacks of non-negative integers, stack A and stack B where index 0 denotes the top of the stack.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |