Roman to Integer

Problem 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, is written as in Roman numeral, just two one’s added together. is written as , which is simply . The number is written as , which is . Roman…

Read More

Longest Common Prefix

Problem 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: Example 2: Constraints: 0 <= strs.length <= 200 0 <= strsi.length <= 200 strsi consists of only lower-case English letters. My Solution…

Read More

Valid Parentheses

Problem Given a string s containing just the characters , , , , and , determine if the input string is valid. An input string is valid if: Open brackets must be closed by the same type of brackets. Open brackets must be closed in the correct order. Example 1: Example 2: Example 3: Example…

Read More

Merge Two Sorted Lists

Problem Merge two sorted linked lists and return it as a sorted list. The list should be made by splicing together the nodes of the first two lists. Example 1: Example 2: Example 3: Constraints: The number of nodes in both lists is in the range 0, 50. -100 <= Node.val <= 100 Both l1 and l2 are…

Read More

Remove Duplicates from Sorted Array

Problem Given a sorted array nums, remove the duplicates in-place such that each element appears only once and returns the new length. Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1) extra memory. Clarification: Confused why the…

Read More
Page 25 Of 26