Eat Study Love

먹고 공부하고 사랑하라

Coding_Practice 178

Binary Tree Inorder Traversal[E,Stack,Tree,Depth-First Search,Binary Tree]

https://leetcode.com/problems/binary-tree-inorder-traversal/description/Given the root of a binary tree, return the inorder traversal of its nodes' values. Example 1:Input: root = [1,null,2,3]Output: [1,3,2]Example 2:Input: root = []Output: []Example 3:Input: root = [1]Output: [1] Constraints:The number of nodes in the tree is in the range [0, 100].-100 굉장히 기초적인 것이라고 생각했던 부분들인데 모르겠다아 짜증난다.. 1. P..

Coding_Practice 2024.07.31

C++ Container, Custom Map Practice

답안?을 좀 보긴 했지만 그래도 차분히 코드를 짜봤다. 해당과제는 C++의 기본적인 OOP 특성은 물론, Container의 특징까지 잘 파악해볼 수 있는 과제이다. 일단 첫 번째 hw2-1의 경우 나의 코드는 아래와 같소 1. Container 과제//Container.hpp#include #include using namespace std;// Implement definition of all classes and the member functions in this file.class Container{public: float size; float capa; string* code; string str; Container(float s):size(s),code(nullptr..

Coding_Practice 2024.07.29

Convert 1D Array Into 2D Array[E,Array,Matrix,Simulation]

https://leetcode.com/problems/convert-1d-array-into-2d-array/description/You are given a 0-indexed 1-dimensional (1D) integer array original, and two integers, m and n. You are tasked with creating a 2-dimensional (2D) array with  m rows and n columns using all the elements from original.The elements from indices 0 to n - 1 (inclusive) of original should form the first row of the constructed 2D ..

Coding_Practice 2024.07.26

Adding Spaces to a String[M,ArrayTwo Pointers,String,Simulation]

https://leetcode.com/problems/adding-spaces-to-a-string/description/You are given a 0-indexed string s and a 0-indexed integer array spaces that describes the indices in the original string where spaces will be added. Each space should be inserted before the character at the given index.For example, given s = "EnjoyYourCoffee" and spaces = [5, 9], we place spaces before 'Y' and 'C', which are at..

Coding_Practice 2024.07.26

Design HashMap[E,Array,Hash Table,Linked List,Design,Hash Function]

https://leetcode.com/problems/design-hashmap/description/Design a HashMap without using any built-in hash table libraries.Implement the MyHashMap class:MyHashMap() initializes the object with an empty map.void put(int key, int value) inserts a (key, value) pair into the HashMap. If the key already exists in the map, update the corresponding value.int get(int key) returns the value to which the s..

Coding_Practice 2024.07.26