본문 바로가기

hello world/algorithm

(33)
오늘의 알고리즘: Longest Common Prefix (14. LeetCode) leetcode.com/problems/longest-common-prefix/ Longest Common Prefix - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com
오늘의 알고리즘: Count and Say (38. LeetCode) leetcode.com/problems/count-and-say/ Count and Say - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 1을 시작으로 해서, "1"이 한개니까 11이 되고 연속된 같은 숫자 "1"이 2개니까 (갯수)(연속된숫자) 21이 된다. 그리고 "2"는 1개. '1"이 1개니까 1211이 된다. 그리고 "1"이 1개, "2"가 1개, "1"이 2개 이므로 111221이 된다. for loop를 돌면서 2차원 배열로 풀었다.
오늘의 알고리즘: Implement strStr() (28. LeetCode) leetcode.com/problems/implement-strstr/ Implement strStr() - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com strings 패키지를 한번 정리하고 나니까 생각보다 golang strings 패키지에 괜찮은게 많음 패키지 정리는 sort랑 ctrconv도 진행할 예정!
오늘의 알고리즘: String to Integer (atoi) (8. LeetCode) leetcode.com/problems/string-to-integer-atoi/ String to Integer (atoi) - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com
오늘의 알고리즘: Valid Palindrome (125. LeetCode) leetcode.com/problems/valid-palindrome/ Valid Palindrome - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com package main import ( "fmt" "strings" "unicode" ) func main() { fmt.Println(isPalindrome("A man, a plan, a canal: Panama")) // fmt.Println(isPalindrome("race a car")) } func i..
오늘의 알고리즘: Valid Anagram (242. LeetCode) leetcode.com/problems/valid-anagram/ Valid Anagram - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 배열이 같은지 비교하는 reflect 패키지의 DeepEqual 함수. t1, t2 := strings.Split(s, ""), strings.Split(t, "") sort.Strings(t1) sort.Strings(t2) fmt.Println(reflect.DeepEqual(t1, t2))
오늘의 알고리즘: First Unique Character in a String (387. LeetCode) leetcode.com/problems/first-unique-character-in-a-string/ First Unique Character in a String - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com golang의 map은 js와 달리 순서를 보장하지 않는다.
오늘의 알고리즘: Reverse Integer (7. LeetCode) leetcode.com/problems/reverse-integer/ Reverse Integer - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 룬 타입에 대한 설명. stackoverflow.com/questions/19310700/what-is-a-rune What is a rune? What is a rune in Go? I've been googling but Golang only says in one line: rune is an alias for ..