본문 바로가기

Coding 공부기록

(15)
Leetcode 뿌시기 - Tree 문제 Binary Tree Right Side View Symmetric Tree Recover Binary Search Tree Top K Frequent Elements 1. Binary Tree (이진 트리) : 보통 O(logn)의 time complexity (출처: https://starrykss.tistory.com/1911#:~:text=%EC%BB%B4%ED%93%A8%ED%84%B0%EB%8A%94%20%EB%8D%B0%EC%9D%B4%ED%84%B0%EB%A5%BC%200,%EC%9D%B4%ED%95%98%EB%A1%9C%20%EA%B5%AC%EC%84%B1%EB%90%98%EC%96%B4%20%EC%9E%88%EB%8B%A4.) 루트를 레벨 0으로 두면, 나뭇잎(leaf)들은 아래로 내려..
Monotonic Stack - Identify Pattern Stack: 한 쪽 끝에서만 자료를 넣고 뺄 수 있는 LIFO(Last In First Out) / FILO (First In Last Out) 형식의 자료 구조. 가장 최근에 더해진 항목이 가장 먼저 제거되는 구조이며, pop(), push(item), peek(), Empty() 등의 functions이 있다. The functions associated with stack are: empty(): returns whether the stack is empty - Time complexity: O(1) size(): returns the size of the stack - Time complexity: O(1) top()/ peek(): returns a reference to the topmost ..
[R] Convert Data between Wide and Long Format Here I summarize how to convert data between wide and long format based on tidyverse grammar. 1. Wide to Long format (1) spread function. spread(data, key, value, fill) key는 wide type으로 바꿨을 때 변수들로 바뀔 내용들이 있는 변수 value는 그 변수들의 칼럼의 값이 될 것 fill은 빈칸에 넣을 것 (2) pivot_wider() #새로 나온 spread의 업그레이드 버전. 이제 요걸 사용하도록 하자! pivot_wider (data, names_from = 변수, values_from = 변수, values_fill = 0) key를 names_from으로..
타임리 부트캠프 시즌2 리트코드 숙제1 1. Add Binary (will do mock interview next class) https://leetcode.com/problems/add-binary/ Ref: https://www.programiz.com/article/python-self-why#:~:text=The%20self%20keyword%20is%20used,information%20for%20both%20these%20objects. Python is a object-oriented programming. In obejct-oriented programming, whenever we define methods for a class, we use 'self' as the first parameter in each case. Cl..
Top 8 Data Structures for Coding Interviews I get to know this links and questions from my mentor in Timely Bootcamp. Reference: https://www.youtube.com/watch?v=uhYq27iSk9s 1. Array - Array is stored in a contiguous way. In RAM, the array would be stored in a subset of that memory in order. - If we know the index that we want to access, we can directly figure out what is the value in constant time. - However, in terms of inserting and rem..
Behavior Questions Preparation (~6/28) 1. Tell me a time when you faced a tight/impossible deadline. Eutopia way: Does our deadline can be pushed? => Pushed deadline with enough timeline Realife way: Does our deadline can't be pushed? => Try to rescope the outcome and focus on making a Minimum Viable Product (MVP) to submit/launch. Lean하게 갈 수 있는 task 인지 (추후 수정이 가능) vs. 타협할 수 없는 task 인지 Manager한테 escalation 한다 -> 내가 research 최대한 해서 op..
[statistics] sample size 구하기 Let's say you're analyzing an AB test with a test and control group. 1. How do you calculate the sample size necessary for an accurate measurement? Answer: https://blog.remesh.ai/how-to-calculate-sample-size Five steps to finding your sample size Define population size or number of people Your sample size needs will differ depending on the true population size or the total number of people you’r..
[SQL]leetcode medium 뿌시기 2021/10/31 1. #608. Tree Node (14min) Tree: id | p_id id is the primary key column for this table. *Each node in the tree can be one of three types: Leaf/Root/Inner(neither a leaf node nor a root node) Write an SQL query to report the type of each node in the tree. Return the result table ordered by id in ascending order. The query result format is in the following example. --output: id | type #..