[Leetcode] 34. Find First and Last Position of Element in Sorted Array (JavaScript) Source https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array/solution/ Find First and Last Position of Element in Sorted Array - LeetCode Can you solve this real interview question? Find First and Last Position of Element in Sorted Array - Given an array of integers nums sorted in ..
Problem solve
[Leetcode] 27. Remove Element (JavaScript) Source https://leetcode.com/problems/remove-element/ Remove Element - LeetCode Can you solve this real interview question? Remove Element - Given an integer array nums and an integer val, remove all occurrences of val in nums in-place [https://en.wikipedia.org/wiki/In-place_algorithm]. The order of the elements may be changed. Then r leetcode.com Code /..
26. Remove Duplicates from Sorted Array Source https://leetcode.com/problems/remove-duplicates-from-sorted-array/ Remove Duplicates from Sorted Array - LeetCode Can you solve this real interview question? Remove Duplicates from Sorted Array - Given an integer array nums sorted in non-decreasing order, remove the duplicates in-place [https://en.wikipedia.org/wiki/In-place_algorithm] such that eac..
48. Rotate Image (Python) Source https://leetcode.com/problems/rotate-image/ Rotate Image - LeetCode Can you solve this real interview question? Rotate Image - You are given an n x n 2D matrix representing an image, rotate the image by 90 degrees (clockwise). You have to rotate the image in-place [https://en.wikipedia.org/wiki/In-place_algorithm], which m leetcode.com Code class Solution: def ro..
11. Container With Most Water (JavaScript) Source https://leetcode.com/problems/container-with-most-water/ Container With Most Water - LeetCode Can you solve this real interview question? Container With Most Water - You are given an integer array height of length n. There are n vertical lines drawn such that the two endpoints of the ith line are (i, 0) and (i, height[i]). Find two lines that tog..
28. Find the Index of the First Occurrence in a String Source https://leetcode.com/problems/find-the-index-of-the-first-occurrence-in-a-string/ Find the Index of the First Occurrence in a String - LeetCode Can you solve this real interview question? Find the Index of the First Occurrence in a String - Given two strings needle and haystack, return the index of the first occurrence of needle in ha..
[LeetCode] 35. Search Insert Position (Javascript) Source https://leetcode.com/problems/search-insert-position/ Search Insert Position - LeetCode Can you solve this real interview question? Search Insert Position - Given a sorted array of distinct integers and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order. You mus..
[Leetcode] 14. Longest Common Prefix Source https://leetcode.com/problems/longest-common-prefix/ Longest Common Prefix - LeetCode Can you solve this real interview question? Longest Common Prefix - Write a function to find the longest common prefix string amongst an array of strings. If there is no common prefix, return an empty string "". Example 1: Input: strs = ["flower","flow" leetcode.com C..
Source https://leetcode.com/problems/array-prototype-last/ Code Array.prototype.last = function () { if (this.length) { return this[this.length - 1]; } else { return -1; } }; /** * const arr = [1, 2, 3]; * arr.last(); // 3 */ How to solve? 리트코드에 자바스크립트 문제가 새로 생겨서 풀어봤다. this 바인딩을 이용해서 프로토타입의 메서드를 만들어준다. 코드 분석 소스 https://leetcode.com/problems/array-prototype-last/solutions/3407591/100-beat-runtime..
Source https://leetcode.com/problems/roman-to-integer/description/ Roman to Integer - LeetCode Can you solve this real interview question? Roman to Integer - Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. Symbol Value I 1 V 5 X 10 L 50 C 100 D 500 M 1000 For example, 2 is written as II in Roman numeral, just tw leetcode.com Code /** * @param {string} s * @retu..