일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 31 |
- Class
- Generator
- Protocol
- Regular Expression
- 315. Count of Smaller Numbers After Self
- t1
- Convert Sorted List to Binary Search Tree
- Decorator
- 시바견
- attribute
- kaggle
- Python
- Substring with Concatenation of All Words
- Python Code
- data science
- concurrency
- Python Implementation
- DWG
- shiba
- iterator
- 프로그래머스
- 109. Convert Sorted List to Binary Search Tree
- 컴퓨터의 구조
- 43. Multiply Strings
- 운영체제
- 30. Substring with Concatenation of All Words
- 715. Range Module
- 파이썬
- 밴픽
- LeetCode
- Today
- Total
목록분류 전체보기 (382)
Scribbling
https://leetcode.com/problems/product-of-array-except-self/ class Solution { public: vector productExceptSelf(vector& nums) { vector zero_idx; int zero_cnt = 0; vector dp1(nums.size()); vector dp2(nums.size()); int prod = 1; for (int i = 0; i < nums.size(); i++) { int num = nums[i]; if (num == 0) { zero_idx.push_back(i); zero_cnt++; } else { prod *= num; dp1[i] = prod; } } prod = 1; for (int i =..
LeetCode 347. Top K Frequent Elements https://leetcode.com/problems/top-k-frequent-elements/ Top K Frequent Elements - LeetCode Can you solve this real interview question? Top K Frequent Elements - Given an integer array nums and an integer k, return the k most frequent elements. You may return the answer in any order. Example 1: Input: nums = [1,1,1,2,2,3], k = 2 Output: [1,2] leetcode.com stru..
class Solution { public: vector groupAnagrams(vector& strs) { unordered_map map; for (string str : strs) { string sorted_str = str; sort(sorted_str.begin(), sorted_str.end()); map[sorted_str].push_back(str); } vector ret; for (auto e : map) { ret.push_back(e.second); } return ret; } };
https://leetcode.com/problems/valid-anagram/ class Solution { public: bool isAnagram(string s, string t) { if (s.size() != t.size()) { return false; } unordered_map map1; unordered_map map2; for (auto c : s) { map1[c]++; } for (auto c : t) { map2[c]++; } for (auto x : map1) { if (x.second != map2[x.first]) { return false; } } return true; } };
https://leetcode.com/problems/contains-duplicate/ class Solution { public: bool containsDuplicate(vector& nums) { return nums.size() > unordered_set(nums.begin(), nums.end()).size(); } };
How does one can find the number of pairs in an array that satisfies the below condition? : lower
In a network system, a rate limiter controls the traffic rate that a client or a service sends. Most APIS have rate limiters in any form. Rate limiter 1) prevents DOS (Denial of Service); 2) reduces costs; and 3) prevents server overloads. Where should the rate limiter be placed? - It can be placed on the server side. - We may put a separate middleware layer for the rate limiter. In the cloud mi..
CS interview is a process where two people discuss a vague problem where there's no set solution. It's more of a simulation of the process of trying to look for potential solutions to the problem. 1. Ask the right questions Do not make an answer before clarifying things. One of the most important virtues that an engineer should have is asking the right questions. Example questions: - What featur..
1. Simple Web Application 2. Relational vs Non-relational DB Non-relational DB - very low latency - can handle unstructured data 3. Load Balancer Relying on a single server can be problematic; it may not handle heavy traffic. A load balancer can operate a web application with many servers. 4. Database Multiplexing Database multiplexing not only enhances the overall system reliability but also im..
Q: Given arbitrary ranges, merge all the ranges that overlap with each other. Return the resultant ranges. 1. Sort all the ranges by their start and end. 2. Now that we know that range's start increases we have to take care of the ends --> We have to take care of the two cases below. 3. Code ranges = [] ranges.append(schedules[0]) for s, e in schedules: if s '[Interval]': schedules = [] for i in..