Leetcode Solutions

Leetcode 9: Palindrome Number

Category : Easy Problem Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward. Follow up: Could you solve it without converting the integer to a string? https://leetcode.com/problems/palindrome-number/ Examples Example 1: Example 2: Example 3: Example 4: Constraints -231 <= x <= 231 – 1 Solution Approach To check if the number is […]

Leetcode 9: Palindrome Number Read More »

Leetcode 1470: Shuffle the Array

Category : Easy Problem Given the array nums consisting of 2n elements in the form [x1,x2,…,xn,y1,y2,…,yn]. Return the array in the form [x1,y1,x2,y2,…,xn,yn]. https://leetcode.com/problems/shuffle-the-array/ Examples Example 1:

Example 2:

Example 3:

Constraints: 1 <= n <= 500 nums.length == 2n 1 <= nums[i] <= 10^3 Solution Approach The solution is pretty straight forward you just need to find

Leetcode 1470: Shuffle the Array Read More »

Leetcode 20

Leetcode 20: Valid Parenthesis

Category : Easy 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. leetcode.com/problems/valid-parentheses/ Examples: Example 1

Example 2

Example 3

Example

Leetcode 20: Valid Parenthesis Read More »