Hash Table

Minimum Cost to Merge Stones

Letter Combinations of a Phone LeetCode Solution | Easy Approach

Letter Combinations of a Phone | Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent. Return the answer in any order. A mapping of digit to letters (just like on the telephone buttons) is given below. Note that 1 does not map to any letters. Example 1: Input: digits …

Letter Combinations of a Phone LeetCode Solution | Easy Approach Read More »

Minimum Cost to Merge Stones

Roman to Integer LeetCode Solution | Easy Approach

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 two one’s added together. 12 is written as XII, which is simply X + II. The number 27 is written as XXVII, which is XX + V + …

Roman to Integer LeetCode Solution | Easy Approach Read More »

Minimum Cost to Merge Stones

Integer to Roman Leetcode Solution | Easy Approach

Integer to Roman | 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 two one’s added together. 12 is written as XII, which is simply X + II. The number 27 is written as XXVII, which is XX + V + …

Integer to Roman Leetcode Solution | Easy Approach Read More »

Two Sum Leetcode Optimal Solution | C++ | Java | Python

Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target. You may assume that each input would have exactly one solution, and you may not use the same element twice. You can return the answer in any order. Example 1: Input: nums = [2,7,11,15], target = 9 Output: [0,1] Explanation: Because …

Two Sum Leetcode Optimal Solution | C++ | Java | Python Read More »

Minimum Cost to Merge Stones

Longest Substring Without Repeating Characters Leetcode Solution

Longest Substring Without Repeating Characters | Given a string s, find the length of the longest substring without repeating characters. Example 1: Input: s = “abcabcbb” Output: 3 Explanation: The answer is “abc”, with the length of 3. Example 2: Input: s = “bbbbb” Output: 1 Explanation: The answer is “b”, with the length of 1. Example 3: …

Longest Substring Without Repeating Characters Leetcode Solution Read More »

x