String3 LeetCode 49. Group Anagrams Problem: Given an array of strings, group anagrams together. Example: Input: ["eat", "tea", "tan", "ate", "nat", "bat"], Output: [ ["ate","eat","tea"], ["nat","tan"], ["bat"] ] Summary: 1. Create a defaultdict(list) to save the sorted word as a key in list format. 2. For each word, sort the word so that any anagram word would be saved in a list under same key. 3. return with all values saved in .. 2020. 8. 19. LeetCode. Validate IP Address Problem: Write a function to check whether an input string is a valid IPv4 address or IPv6 address or neither. IPv4 addresses are canonically represented in dot-decimal notation, which consists of four decimal numbers, each ranging from 0 to 255, separated by dots ("."), e.g.,172.16.254.1; Besides, leading zeros in the IPv4 is invalid. For example, the address 172.16.254.01 is invalid. IPv6 addr.. 2020. 6. 17. LeetCode.Roman to Integer [Math] Problem: Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. Symbol Value I 1 V 5 X 10 L 50 C 100 D 500 M 1000 For example, two is written as II in Roman numeral, just two one's added together. Twelve is written as, XII, which is simply X + II. The number twenty seven is written as XXVII, which is XX + V + II. Roman numerals are usually written largest to smallest .. 2020. 6. 16. 이전 1 다음