PS [릿코드 8] String to Integer (atoi) (파이썬/python) 2023. 4. 4. https://leetcode.com/problems/string-to-integer-atoi/description/ String to Integer (atoi) - LeetCode Can you solve this real interview question? String to Integer (atoi) - Implement the myAtoi(string s) function, which converts a string to a 32-bit signed integer (similar to C/C++'s atoi function). The algorithm for myAtoi(string s) is as follows: 1. Read leetcode.com 단순히 문제에서 제시하는 상황을 구현하는문제였습.. [릿코드 380] Insert Delete GetRandom O(1) (파이썬/python) 2023. 3. 24. https://leetcode.com/problems/insert-delete-getrandom-o1/description/ Insert Delete GetRandom O(1) - LeetCode Can you solve this real interview question? Insert Delete GetRandom O(1) - Implement the RandomizedSet class: * RandomizedSet() Initializes the RandomizedSet object. * bool insert(int val) Inserts an item val into the set if not present. Returns true if th leetcode.com 릿코드에는 이런 유형도있구나 생각.. [릿코드 1390] Four Divisors (파이썬/python) 2023. 3. 24. https://leetcode.com/problems/four-divisors/ Four Divisors - LeetCode Can you solve this real interview question? Four Divisors - Given an integer array nums, return the sum of divisors of the integers in that array that have exactly four divisors. If there is no such integer in the array, return 0. Example 1: Input: nums leetcode.com 약수를 구할때 어짜피 제곱근 까지만 구하면 알아서 짝이 있을거라는 가정하에 계산하면됐습니다. 소수랑 비슷한느낌.. [릿코드 1466] Reorder Routes to Make All Paths Lead to the City Zero(파이썬/python) 2023. 3. 24. https://leetcode.com/problems/reorder-routes-to-make-all-paths-lead-to-the-city-zero/description/ Reorder Routes to Make All Paths Lead to the City Zero - LeetCode Can you solve this real interview question? Reorder Routes to Make All Paths Lead to the City Zero - There are n cities numbered from 0 to n - 1 and n - 1 roads such that there is only one way to travel between two different cities (t.. [릿코드 1297] Maximum Number of Occurrences of a Substring (파이썬/python) 2023. 3. 24. https://leetcode.com/problems/maximum-number-of-occurrences-of-a-substring/description/ Maximum Number of Occurrences of a Substring - LeetCode Can you solve this real interview question? Maximum Number of Occurrences of a Substring - Given a string s, return the maximum number of ocurrences of any substring under the following rules: * The number of unique characters in the substring must be le.. [릿코드 1319] Number of Operations to Make Network Connected(파이썬/python) 2023. 3. 23. https://leetcode.com/problems/number-of-operations-to-make-network-connected/description/ Number of Operations to Make Network Connected - LeetCode Can you solve this real interview question? Number of Operations to Make Network Connected - There are n computers numbered from 0 to n - 1 connected by ethernet cables connections forming a network where connections[i] = [ai, bi] represents a connec.. [릿코드 2492] Minimum Score of a Path Between Two Cities (파이썬/python) 2023. 3. 22. https://leetcode.com/problems/minimum-score-of-a-path-between-two-cities/description/ Minimum Score of a Path Between Two Cities - LeetCode Can you solve this real interview question? Minimum Score of a Path Between Two Cities - You are given a positive integer n representing n cities numbered from 1 to n. You are also given a 2D array roads where roads[i] = [ai, bi, distancei] indicates that le.. [릿코드 3] Longest Substring Without Repeating Characters (파이썬/python) 2023. 3. 20. https://leetcode.com/problems/longest-substring-without-repeating-characters/ int: answer = 0 # key = char / value = index char_dic = {} left_idx = 0 for right_idx, char in enumerate(s): if char not in char_dic: answer = max(answer, (right_idx - left_idx + 1)) else: if char_dic[char] < left_idx: answer = max(answer, (right_idx - left_idx + 1)) else: left_idx = char_dic[char] + 1 char_dic[char] =.. [릿코드 6] Zigzag Conversion (파이썬/python) 2023. 3. 20. https://leetcode.com/problems/zigzag-conversion/description/ Zigzag Conversion - LeetCode Can you solve this real interview question? Zigzag Conversion - The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H N A P L S I I leetcode.com 단순 구현문제였습니다. 문제에서 지그제그로 문자열을 배치하라 해서 반.. 이전 1 2 3 4 ··· 20 다음