시작!(183)
-
이시야 시로이코이비토
요즘 블로그가 너무 삭막하다... 맛난 후기 하나 올려야겠다. 이렇게 10분이면 올릴수있는데 ~! 반성해야겠다. 일본분 블로그를 보다가 ~ 이 과자를 오랫만에 봤다. 옛날에 먹어본 그 기분 ~ 맛이 생각이 안나 ~ 하지만 분명 맛있었다지 *ㅁ* ! 그래서 시켰다 !!!!!!!! 배송비 8000원 !!!!! ㅋㅋㅋㅋㅋㅋ 무슨 선물 패키지같이 포장이 되어왔다 ㅎㅎㅎ 그래서 기부니가 좋음 ㅎㅎ 포장을 까보면 저렇게 하얀 박스가 나온다. 이게 훗카이도에서 만든건가? 그래서 이렇게 하얀 산이 시그니처인가보다. 남편이 본인 훗카이도 갔다온걸 또 그리워하는걸 내가 알았지 ~ (몰랐음) 24개입 이다 ! 화이트 초콜렛 12개 , 밀크 초콜렛 12개 ! 하얀색이 당연하게 화이트 초콜렛인줄알고 짙은 색 포장 먼저 뜯었는데..
2022.09.01 -
104. Maximum Depth of Binary Tree
Given the root of a binary tree, return its maximum depth. A binary tree's maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node. Example 1: Input: root = [3,9,20,null,null,15,7] Output: 3 Example 2: Input: root = [1,null,2] Output: 2 Constraints: The number of nodes in the tree is in the range [0, 104]. -100 right); return max(l_depth, r_d..
2022.08.30 -
Maximum Depth of BT(Binary Tree)
Given a binary tree, find height of it. Height of empty tree is -1, height of tree with one node is 0 and height of below tree is 2. ( root node 는 0으로 카운트해서 -1을 해주는 거군요. 그래서 아래의 tree 의 depth 는 2임 ! ) maxDepth() 의 pseudo code detail 을 한번 살펴보자. 거꾸로다 거꾸로! 아래의 4,5번부터 count 한다. 4,5는 자식이 없으니 0, 2는 자식(4,5) 이 있으니 1, 1은 2,3이라는 자식이 있으니 2가된다. maxDepth() 1. If tree is empty then return -1. 2. Else ! ( a ) G..
2022.08.30 -
C++ - Stringstream
The stringstream class is extremly useful in parsing input. To use stringstream, we need to include sstream header file. StringStream 은, 공백과 \n 을 제외한 문자열을 빼내는데 유용함. : Read something from the stringstream object. 예제 1. geeks for geeks geeks 를 space 로 나눈 count 값 ! 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 // Example program #include #include #include using namespace s..
2022.08.23 -
unordered_map vs map in C++
map (like set) is an ordered sequence of unique keys whereas in unordered_map key can be stored in any order, so unordered. The time complexity of map operations is O(logN) while for unordered_map, It is O(1) on average. Let us see the differences in a tabular (표로 산출된) form. # About unordered_map unordered_map is an associated container that stores elements formed by the combination of key-value..
2022.08.22 -
832. Flipping an Image
Given an n x n binary matrix image, flip the image horizontally, then invert it, and return the resulting image. To flip an image horizontally means that each row of the image is reversed. For example, flipping [1,1,0] horizontally results in [0,1,1]. To invert an image means that each 0 is replaced by 1, and each 1 is replaced by 0. For example, inverting [0,1,1] results in [1,0,0]. Example 1: ..
2022.08.21 -
977. Squares of a Sorted Array
Given an integer array nums sorted in non-decreasing order, return an array of the squares of each number sorted in non-decreasing order. Example 1: Input: nums = [-4,-1,0,3,10] Output: [0,1,9,16,100] Explanation: After squaring, the array becomes [16,1,0,9,100]. After sorting, it becomes [0,1,9,16,100]. Example 2: Input: nums = [-7,-3,2,3,11] Output: [4,9,9,49,121] Constraints: 1
2022.08.21 -
278. First Bad Version
You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality check. Since each version is developed based on the previous version, all the versions after a bad version are also bad. Suppose you have n versions [1, 2, ..., n] and you want to find out the first bad one, which causes all the following ones to be..
2022.08.21 -
C++ min , max, index 구하기
HEADER : #include 일일히 for 문을 쓰지않아도, algorithm 라이브러리에 있는 min/max_elements를 사용하여 한 줄로도 간단하게 최대값을 구할 수 있다! 또한 해당 최소/최대 값의 index 값을 구할 수 있다. 이는 결과값에서 - v.begin()을 빼주면 된다. min/max_element의 결과로, 최대값을 가리키는 반복자를 반환하기 때문에 * 연산자를 사용한다. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 #include #include #include using namespace std; vector nums; int main() { nums = {123,213,444,455,666,7..
2022.08.21 -
C++ - 2차배열 / 동적할당 패턴 연습 (+입력 정리, vector 인자로 넘길때)
입출력하고 배열에 우선 익숙해져야겠다..... 1. cin / cout 을 쓰는걸로하자. cin / cout 은 C++ 의 String 을 쓸수있다. 근데 printf/scanf는 저걸 못씀. 대신, cin / cout 쓰려면 조건이 몇가지 있다. ios::sync_with_stdio(0); // C++ stream과 C stream의 동기화를 끊어서 프로그램 수행시간 늘리도록 하는기능. cin.tie(0); // cin 명령을 수행하기 전에 cout 버퍼를 비우지 않도록 하는 코드. 이 2개를 같이 써야함. 입출력이 작을때는 상관없지만, 양이 많을때 ( 출력 100만번 / 입력 100만번 ) 지연되어 시간초과 발생할 수 있다. 그리고 , 이걸 쓸때 cin / cout 하고, printf / scanf ..
2022.08.19