'Algorithm/Stack' 카테고리의 글 목록 'Algorithm/Stack' 카테고리의 글 목록
본문 바로가기

Algorithm/Stack8

[LeetCode] Final Prices With a Special Discount in a Shop in JavaScript Description Given the array prices where prices[i] is the price of the ith item in a shop. There is a special discount for items in the shop, if you buy the ith item, then you will receive a discount equivalent to prices[j] where j is the minimum index such that j > i and prices[j] 2022. 4. 1.
[LeetCode] Remove All Adjacent Duplicates In String in JavaScript Description You are given a string s consisting of lowercase English letters. A duplicate removal consists of choosing two adjacent and equal letters and removing them. We repeatedly make duplicate removals on s until we no longer can. Return the final string after all such duplicate removals have been made. It can be proven that the answer is unique. Examples Input: s = "abbaca" Output: "ca" Ex.. 2022. 3. 31.
[LeetCode] N-ary Tree Postorder Traversal in JavaScript Description Given the root of an n-ary tree, return the postorder traversal of its nodes' values. Nary-Tree input serialization is represented in their level order traversal. Each group of children is separated by the null value (See examples) Examples Example 1: Input: root = [1,null,3,2,4,null,5,6] Output: [5,6,3,2,4,1] Example 2: Input: root = [1,null,2,3,4,5,null,null,6,7,null,8,null,9,10,nu.. 2022. 3. 17.
[LeetCode] N-ary Tree Preorder Traversal in JavaScript Description Given the root of an n-ary tree, return the preorder traversal of its nodes' values. Nary-Tree input serialization is represented in their level order traversal. Each group of children is separated by the null value (See examples) Examples Example 1: Input: root = [1,null,3,2,4,null,5,6] Output: [1,3,5,6,2,4] Example 2: Input: root = [1,null,2,3,4,5,null,null,6,7,null,8,null,9,10,nul.. 2022. 3. 16.
LIST