Problem Solving/LeetCode

문제Products of Array Discluding SelfGiven an integer array nums, return an array output where `output[i]` is the product of all the elements of nums except `nums[i]`.Each product is guaranteed to fit in a 32-bit integer.Follow-up: Could you solve it in 𝑂(𝑛) time without using the division operation?Example 1:Input: nums = [1,2,4,6]Output: [48,24,12,8]Example 2:Input: nums = [-1,0,1,2,3]Output: ..
분류: 문자열 / 문제271. String Encode and DecodeDesign an algorithm to encode a list of strings to a single string. The encoded string is then decoded back to the original list of strings.Please implement encode and decode Example 1:Input: ["neet","code","love","you"]Output: ["neet","code","love","you"]Example 2:Input: ["we","say",":","yes"]Output: ["we","say",":","yes"]Constraints:`0 `0 `strs[i]` cont..
분류: 문자열 / 문제 916. Decoded String at Index You are given an encoded string s. To decode the string to a tape, the encoded string is read one character at a time and the following steps are taken: If the character read is a letter, that letter is written onto the tape. If the character read is a digit d, the entire current tape is repeatedly written d - 1 more times in total. Given an integer k, r..
분류: 스택, 문자열 / 문제 문제 링크 Given a string s, remove duplicate letters so that every letter appears once and only once. You must make sure your result is the smallest in lexicographical order among all possible results. Example 1: Input: s = "bcabc" Output: "abc" Example 2: Input: s = "cbacdcbc" Output: "acdb" Constraints: 1
분류: 큐 / 문제 문제 링크 Given a string s, find the length of the longest substring without repeating characters. Example 1: Input: s = "abcabcbb" Output: 3 Explanation: The answer is "abc", with the length of 3. Example 2: Input: s = "bbbbb" Output: 1 Explanation: The answer is "b", with the length of 1. Example 3: Input: s = "pwwkew" Output: 3 Explanation: The answer is "wke", with the length of 3. No..
thecloer
'Problem Solving/LeetCode' 카테고리의 글 목록