leetcode 썸네일형 리스트형 [LeetCode] 1700. Number of Students Unable to Eat Lunch The school cafeteria offers circular and square sandwiches at lunch break, referred to by numbers 0 and 1 respectively. All students stand in a queue. Each student either prefers square or circular sandwiches. The number of sandwiches in the cafeteria is equal to the number of students. The sandwiches are placed in a stack. At each step: If the student at the front of the queue prefers the sandw.. 더보기 [LeetCode] 71. Simplify Path Given a string path, which is an absolute path (starting with a slash '/') to a file or directory in a Unix-style file system, convert it to the simplified canonical path. In a Unix-style file system, a period '.' refers to the current directory, a double period '..' refers to the directory up a level, and any multiple consecutive slashes (i.e. '//') are treated as a single slash '/'. For this p.. 더보기 [LeetCode] 20. Valid Parentheses Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. An input string is valid if: Open brackets must be closed by the same type of brackets. Open brackets must be closed in the correct order. Example 1: Input: s = "()" Output: true Example 2: Input: s = "()[]{}" Output: true Example 3: Input: s = "(]" Output: false Example 4: In.. 더보기 [LeetCode] Running Sum of 1d Array class Solution { public int[] runningSum(int[] nums) { int[] answer = new int[nums.length]; int sum = 0; for(int i=0; i 더보기 [LeetCode] Two Sum class Solution { public int[] twoSum(int[] nums, int target) { int[] answer = new int[2]; for(int i=0; i 더보기 이전 1 다음