Coding Test/LeetCode

https://leetcode.com/problems/most-common-word/ Most Common Word - LeetCode Can you solve this real interview question? Most Common Word - Given a string paragraph and a string array of the banned words banned, return the most frequent word that is not banned. It is guaranteed there is at least one word that is not banned, and tha leetcode.com 내가 쓴 코드 정규표현식따위 개무시하고 하나하나 제거해주기^_^ from collections..
https://leetcode.com/problems/reorder-data-in-log-files/ Reorder Data in Log Files - LeetCode Can you solve this real interview question? Reorder Data in Log Files - You are given an array of logs. Each log is a space-delimited string of words, where the first word is the identifier. There are two types of logs: * Letter-logs: All words (except the leetcode.com 내가 쓴 코드 class Solution: def reorde..
https://leetcode.com/problems/reverse-string/ Reverse String - LeetCode Can you solve this real interview question? Reverse String - Write a function that reverses a string. The input string is given as an array of characters s. You must do this by modifying the input array in-place [https://en.wikipedia.org/wiki/In-place_algo leetcode.com class Solution: def reverseString(self, s: List[str]) ->..
https://leetcode.com/problems/valid-palindrome/ Valid Palindrome - LeetCode Can you solve this real interview question? Valid Palindrome - A phrase is a palindrome if, after converting all uppercase letters into lowercase letters and removing all non-alphanumeric characters, it reads the same forward and backward. Alphanumeric cha leetcode.com 내가 쓴 코드 슬라이싱을 할 생각보단 while문을 통해 하나하나 검사해서 한번이라도 틀린다면..
https://leetcode.com/problems/longest-palindromic-substring/ str: text = s result = [] # 첫번째 반복문 - 앞 글자 하나씩 지우기 for i in range(len(text)): # 두번째 반복문 - 뒤 글자 하나씩 추가하면서 팰린드롬 확인 for j in range(i + 1, len(text) + 1): substring = text[i:j] # 팰린드롬일 경우 결과에 추가 if self.is_palindrome(substring): result.append(substring) # 들어간 팰린드롬 중에 가장 문자열의 길이가 긴 팰린드롬 리턴 longest = self.find_longest_string(result) return l..
https://leetcode.com/problems/group-anagrams/ Group Anagrams - LeetCode Can you solve this real interview question? Group Anagrams - Given an array of strings strs, group the anagrams together. You can return the answer in any order. An Anagram is a word or phrase formed by rearranging the letters of a different word or phrase leetcode.com 처음 써본 코드 from collections import defaultdict class Solut..
문이과 통합형 인재(人災)
'Coding Test/LeetCode' 카테고리의 글 목록