일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
28 | 29 | 30 |
- loop
- leetcode
- security
- AI
- TypeScript
- scss
- JavaScript
- nginx
- docker
- BOJ
- C#
- 보안
- property
- vuetify
- dotenv
- type
- bash
- condition
- vue.js
- machine learning
- var
- Clone
- C++
- Python
- npm
- VUE
- 앙상블
- webpack
- generic
- git
- Today
- Total
목록PS/LeetCode (49)
ice rabbit programming
https://leetcode.com/problems/symmetric-tree/ Symmetric Tree - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 트리의 좌우 대칭을 확인하는 문제이다. 여지껏 푼 easy 단계 문제들 중 로직을 생각하는 데에 가장 오래 걸린 것 같다. 기본적으로 재귀를 사용할 생각은 가지고 있었지만, 좌-우-좌-우와 우-좌-우-좌를 어떻게 구현해야 할지를 몰랐다. /** * Definition for a binary tree nod..
https://leetcode.com/problems/invert-binary-tree/ Invert Binary Tree - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 이전 문제에서 List를 뒤집었다면 이번에는 Tree를 뒤집는 문제이다. 재귀를 이용해서 left와 right를 뒤집는 로직이다. /** * Definition for a binary tree node. * public class TreeNode { * public int val; * pub..
https://leetcode.com/problems/reverse-linked-list/ Reverse Linked List - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 주어진 링크드 리스트를 뒤집는 문제이다. 스택을 이용하면 간단한 로직으로 풀 수 있다. 처음엔 prev를 생각했다가 스택이 더 쉽게 구현이 가능할 것 같아서 방향을 틀었다. 푼 이후에 보니 prev보다 스택이 시간초가 더 빨랐다. 다만 ListNode*를 계속 재사용했더니 Use Afte..
https://leetcode.com/problems/combine-two-tables/ Combine Two Tables - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com # Write your MySQL query statement below SELECT Person.FirstName, Person.LastName, Address.City, Address.State From Person LEFT JOIN Address ON Person.PersonId=Add..
https://leetcode.com/problems/customers-who-never-order/ Customers Who Never Order - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com SQL을 사용하는 문제를 간만에 풀었다. 어려운 문제는 아니고 JOIN과 NOT IN으로 차집합을 구하는 문제였다. # Write your MySQL query statement below SELECT Customers.Name AS Customers From Cus..
https://leetcode.com/problems/add-binary/ Add Binary - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 이 문제도 제목 그대로 이진수로 주어지는 string을 더해서 string으로 반환하는 문제이다. 논리회로 단계에서 Adder를 만들듯이 구현하였다. public class Solution { public string AddBinary(string a, string b) { int shortLength = (a.Leng..
https://leetcode.com/problems/same-tree/ Same Tree - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 제목 그대로 주어진 Tree가 동일한 Tree인지 판단하는 문제이다. DFS를 통해 순회하면서 노드의 값들을 비교하는 식으로 구현하였다. 간만에 메모리와 시간 모두에서 100%를 기록하였다. /** * Definition for a binary tree node. * struct TreeNode { * int val; * ..
https://leetcode.com/problems/majority-element/ Majority Element - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 가장 많이 등장하는 원소를 찾아내는 문제이다. 별 생각 없이 map을 이용해 풀었다. class Solution { public: int majorityElement(vector& nums) { int size = nums.size(); map counts; for(int i=0;isecond)++..