본문 바로가기

Golang12

[LeetCode] 516. Longest Palindromic Subsequence (golang) 문제Longest Palindromic Subsequence - LeetCodeGiven a string s, find the longest palindromic subsequence's length in s. A subsequence is a sequence that can be derived from another sequence by deleting some or no elements without changing the order of the remaining elements. Example 1: Input: s = "bbbab"Output: 4Explanation: One possible longest palindromic subsequence is "bbbb".https://leetco.. 2021. 6. 14.
[LeetCode] 409. Longest Palindrome (golang) 문제Longest Palindrome - LeetCodeGiven a string s which consists of lowercase or uppercase letters, return the length of the longest palindrome that can be built with those letters. Letters are case sensitive, for example, "Aa" is not considered a palindrome here. Example 1: Input: s = "abccccdd"Output: 7Explanation: One longest palindrome that can be built is "dccaccd", whose length is 7.https://.. 2021. 6. 12.
[LeetCode] 104. Maximum Depth of Binary Tree (golang) 문제Maximum Depth of Binary Tree - LeetCodeLevel 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.https://leetcode.com/problems/maximum-depth-of-binary-tree/이진 트리에서 최대 깊이 구하기 구현모든 가지를 탐색하여 깊이를 갱신 ( N ) 시간 복잡도O(N) 코드/** * Definition for a binary tree node. * type TreeNode struct { * Val int * Left *TreeNode * Righ.. 2021. 6. 7.
[LeetCode] 66. Plus One (golang) 문제Plus One - LeetCodeGiven a non-empty array of decimal digits representing a non-negative integer, increment one to the integer. The digits are stored such that the most significant digit is at the head of the list, and each element in the array contains a single digit.https://leetcode.com/problems/plus-one/정수의 각 자릿수를 나타내는 배열에서 그 정수에 1을 더한 값을 나타내는 배열 구하기 구현맨 뒤에서부터 1을 더함더했을 때 9가 넘으면 0을 주고 그 다음으로.. 2021. 6. 2.
[LeetCode] 205. Isomorphic Strings (golang) 문제Isomorphic Strings - LeetCodeGiven two strings s and t, determine if they are isomorphic. Two strings s and t are isomorphic if the characters in s can be replaced to get t. All occurrences of a character must be replaced with another character while preserving the order of characters.https://leetcode.com/problems/isomorphic-strings/구조가 같은 문자열 구분 구현각 문자열의 문자를 키로 받는 맵을 두 문자열 각각 생성문자열을 탐색하며 각 맵에.. 2021. 6. 2.
[LeetCode] 455. Assign Cookies (golang) 문제Assign Cookies - LeetCodeAssume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie. Each child i has a greed factor g[i], which is the minimum size of a cookie that the child will be content with; and each cookie j has a size s[j].https://leetcode.com/problems/assign-cookies/쿠키를 나눠주어 만족시킬 수 있는 아이들의 최대수 구현정렬 ( NlogN? )아이에게 줄.. 2021. 6. 1.