반응형

leetcode 8

LeetCode - median of two sorted arrays

Median of Two Sorted Arrays - 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 나의 풀이 - 실패 떠올린 방식 1. 하나의 배열에 모두 넣고 binary search - time complexity : O(n log n) - 문제의 시간 복잡도 제한 조건을 만족하지 못하는 풀이 2. lowerBound를 이용해서 해당 수보다 작거나 같은 수를 찾아서 각각 확인하는 방식 - time complexity : O(log (n + m)) - 배열의..

Leet Code - Longest Substring Without Repeating Characters

Longest Substring Without Repeating Characters - 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 나의 풀이 class Solution { public int lengthOfLongestSubstring(String s) { int len = s.length(); Map map = new HashMap(); int maxLen = 0; int curLen = 0; for (int i = 0; i < len; i++) { if ..

반응형