Eat Study Love

먹고 공부하고 사랑하라

C++ 147

Maximum Width of Binary Tree[M,Tree,Depth-First Search,Breadth-First Search,Binary Tree]

https://leetcode.com/problems/maximum-width-of-binary-tree/description/Given the root of a binary tree, return the maximum width of the given tree.The maximum width of a tree is the maximum width among all levels.The width of one level is defined as the length between the end-nodes (the leftmost and rightmost non-null nodes), where the null nodes between the end-nodes that would be present in a ..

Coding_Practice 2024.08.22

Rotate List[Linked List,Two Pointers]

https://leetcode.com/problems/rotate-list/description/Given the head of a linked list, rotate the list to the right by k places. Example 1:Input: head = [1,2,3,4,5], k = 2Output: [4,5,1,2,3]Example 2:Input: head = [0,1,2], k = 4Output: [2,0,1] Constraints:The number of nodes in the list is in the range [0, 500].-100 0 1. C또 Naive하게 했다가 얻어 맞은 Time Limit ㅠㅠC는 빠른 언어라 상관 없을 줄 알았는데 얄짤 없네/** * Definit..

Coding_Practice 2024.08.20

Best Time to Buy and Sell Stock II[M,Array,Dynamic Programming,Greedy]

https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii/description/You are given an integer array prices where prices[i] is the price of a given stock on the ith day.On each day, you may decide to buy and/or sell the stock. You can only hold at most one share of the stock at any time. However, you can buy it then immediately sell it on the same day.Find and return the maximum profit yo..

Coding_Practice 2024.08.20