Eat Study Love

먹고 공부하고 사랑하라

C 169

Find the Student that Will Replace the Chalk[M,Array,Binary Search,Simulation,Prefix Sum]

https://leetcode.com/problems/find-the-student-that-will-replace-the-chalk/description/?envType=daily-question&envId=2024-09-02There are n students in a class numbered from 0 to n - 1. The teacher will give each student a problem starting with the student number 0, then the student number 1, and so on until the teacher reaches the student number n - 1. After that, the teacher will restart the pr..

Coding_Practice 2024.09.02

Add One Row to Tree[M,Tree,Depth-First Search,Breadth-First Search,Binary Tree]

https://leetcode.com/problems/add-one-row-to-tree/?envType=daily-question&envId=2024-08-23Given the root of a binary tree and two integers val and depth, add a row of nodes with value val at the given depth depth.Note that the root node is at depth 1.The adding rule is:Given the integer depth, for each not null tree node cur at the depth depth - 1, create two tree nodes with value val as cur's l..

Coding_Practice 2024.08.23

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

Same Tree[E,Tree,Depth-First Search,Breadth-First Search,Binary Tree]

https://leetcode.com/problems/same-tree/description/Given the roots of two binary trees p and q, write a function to check if they are the same or not.Two binary trees are considered the same if they are structurally identical, and the nodes have the same value. Example 1:Input: p = [1,2,3], q = [1,2,3]Output: trueExample 2:Input: p = [1,2], q = [1,null,2]Output: falseExample 3:Input: p = [1,2,1..

Coding_Practice 2024.08.22

C Struct 연습

첨부파일의 코드에는 필자가 직접 연습한 것과 약간의 낙서(?)가 가미되어 있다ㅎㅎ   C에는 Python / C++의 Class와 유사하게 Struct라는 구조가 있다. 이 Struct는 Array보단 고차원의 구조로, 각 종 data type 또는 다른 Sturct type의 Variable을 member로 가질 수 있다. 하지만, fucntion을 Member 변수로 갖지 못하고 Class 상속 / Polymorphism, Instance Construct/Destruct 등 객체지향프로그래밍 즉 Oriented Object Programming을 실행하기엔 부족함이 많다. 그래도 보수적인 C Programming 영역에서 가장 고차원적인 구조이기에 연습이 필요하다. Q1.  첫 번째론 좌표평면 상에..

SW 만학도/C 2024.08.22