## 11. Integer to Roman

Problem Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. 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 + II. Roman numerals are usually written largest to smallest from left to right. However, Read more…

## 11. Container With Most Water

Problem 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 together with the x-axis form a container, such that the container contains the most water. Return the maximum amount of water a container can store. Read more…

## 10. Regular Expression Matching

Problem Given an input string s and a pattern p, implement regular expression matching with support for ‘.’ and ‘*’ where: ‘.’ Matches any single character.​​​​ ‘*’ Matches zero or more of the preceding element. The matching should cover the entire input string (not partial). Problem description Given an input string s and a pattern p, we need to implement a Read more…

## 9. Palindrome Number

Problem Description Given an integer x, return true if x is a palindrome, and false otherwise. Given an integer x, the task is to determine if it is a palindrome. A palindrome is a number that remains the same when its digits are reversed. For example, 121 is a palindrome, but 123 is not. Solution The solution to Read more…

## 8. String to Integer (atoi)

Problem description Implement the myAtoi(string s) function, which converts a string to a 32-bit signed integer (similar to C/C++’s atoi function). The algorithm for myAtoi(string s) is as follows: Read in and ignore any leading whitespace. Check if the next character (if not already at the end of the string) is ‘-‘ or ‘+’. Read this character in if Read more…

## 7. Reverse Integer

Problem description Given a signed 32-bit integer x, return x with its digits reversed. If reversing x causes the value to go outside the signed 32-bit integer range [-231, 231 – 1], then return 0. Assume the environment does not allow you to store 64-bit integers (signed or unsigned). Solution Given a signed 32-bit integer x, the Read more…

## 6. Zigzag Conversion

Problem Description The Zigzag Conversion problem involves converting a given string into a zigzag pattern with a specified number of rows. The pattern is read line by line, and the result should be the concatenation of each line. For example, the string “PAYPALISHIRING” with 3 rows would result in “PAHNAPLSIIGYIR”. Read more…

## 5. Longest Palindromic Substring

The Longest Palindromic Substring problem can be solved using dynamic programming. The idea is to use a 2D array to store whether a substring is a palindrome or not. We then traverse the string using two nested loops and update the array based on whether the characters at the beginning Read more…

## 4. Median of Two Sorted Arrays

Problem description Given two sorted arrays nums1 and nums2 of size m and n respectively, return the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). Solution Finding the median of two sorted arrays is a common problem in computer science, and it can have many real-world applications. In this article, we’ll look at four Read more…

## 3. Longest Substring Without Repeating Characters

Problem Description Given a string s, find the length of the longestsubstring without repeating characters. In computer science, a string is a sequence of characters, and a substring is a contiguous sequence of characters within a string. Given a string s, the task of finding the length of the longest substring without repeating Read more…