-
[Day12] 15. 3Sum@StudY/.algorithm 2019. 3. 6. 11:17
Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c= 0? Find all unique triplets in the array which gives the sum of zero.Note:The solution set must not contain duplicate triplets.Example:Given array nums = [-1, 0, 1, 2, -1, -4], A solution set is: [ [-1, 0, 1], [-1, -1, 2] ] 어... 상당히 어려운 문제다.....어떻게 접근을 해야하지???? 최적의 Big-O 시간 복잡가 과연 뭘까????
-
[구직일기] Company B - Software Engineer@NerdY 2019. 3. 5. 15:24
28th JAN 2019 3월 초 인턴이 끝날 것을 대비해 glassdoor를 살펴보다가 너무너무 흥미롭고 관심이 가는 회사의 SW 엔지니어 position job 공고를 발견했다. IT 기업은 아니지만 IT 전문종사자로서 해당 기업에 뿐만 아니라 세계 모든 사람들의 편의에 크게 기여할 수 있을 것 같았다. Software Engineer (Early Career) Location SeoulKorea Republic ofKorea Republic of Job Description We are seeking a Software Engineer to join a dynamic team that is focused on creating and delivering advanced production soluti..
-
[Day11] 830. Positions of Large Groups@StudY/.algorithm 2019. 3. 4. 16:05
830. Positions of Large Groups class Solution { public List largeGroupPositions(String S) { S = S+"\0"; List positions = new ArrayList(); int largest=1; if (S.length()==0) return positions; for (int i=0; i= 3) { List largeGroup = new ArrayList(); largeGroup.add(i-(largest-1)); largeGroup.add(i); positions.add(largeGroup); } largest=1; } else { largest++; } } return positions; }} Accepted6 ms39.9..
-
[Day10] 430. Flatten a Multilevel Doubly Linked List@StudY/.algorithm 2019. 2. 28. 18:02
430. Flatten a Multilevel Doubly Linked List Medium /*// Definition for a Node.class Node { public int val; public Node prev; public Node next; public Node child; public Node() {} public Node(int _val,Node _prev,Node _next,Node _child) { val = _val; prev = _prev; next = _next; child = _child; }};*/class Solution { public Node flatten(Node head) { Node flatten = head; Node temp = null; Node count..
-
[Day7] 876. Middle of the Linked List / 86. Partition List (LeetCode)@StudY/.algorithm 2019. 2. 22. 14:12
빛나는 졸업장을 타느라 어제는 회사도 알고리즘 공부도 하루 휴식! 876. Middle of the Linked List Easy /** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int x) { val = x; } * } */class Solution { public ListNode middleNode(ListNode head) { ListNode middle = head; ListNode counter = head; int count=1; while(counter.next!=null) { count++; counter = counter.next; } for (in..
-
[Day6] 981. Time Based Key-Value Store@StudY/.algorithm 2019. 2. 20. 14:15
981. Time Based Key-Value Store import java.util.HashMap.*; class TimeMap { HashMap map = new HashMap(); /** Initialize your data structure here. */ public TimeMap() { } public void set(String key, String value, int timestamp) { if (!map.containsKey(key)) { ArrayList list = new ArrayList(); list.add(value); list.add(timestamp+""); map.put(key,list); } else { map.get(key).add(value); map.get(key)..
-
[Day4] 529. Minesweeper@StudY/.algorithm 2019. 2. 18. 11:30
529. Minesweeper class Solution { public char[][] updateBoard(char[][] board, int[] click) { int ci = click[0]; int cj = click[1]; if (board[ci][cj]=='M') { board[ci][cj]='X'; return board; } else { int[] i = {-1,-1,-1, 0,0, 1,1,1}; int[] j = {-1, 0, 1,-1,1,-1,0,1}; int adjacents = 0; for (int k=0; k