Open in app

Sign In

Write

Sign In

Vivek Singh
Vivek Singh

12 Followers

Home

About

Oct 25, 2022

Reverse Only Letters

Given a string s, reverse the string according to the following rules: All the characters that are not English letters remain in the same position. All the English letters (lowercase or uppercase) should be reversed. Return s after reversing it. Example 1: Input: s = "ab-cd" Output: "dc-ba" Example 2: …

Data Structures

1 min read

Data Structures

1 min read


Dec 1, 2021

LeetCode — Number of Good Ways to Split a String

You are given a string s, a split is called good if you can split s into 2 non-empty strings p and q where its concatenation is equal to s and the number of distinct letters in p and q are the same. Return the number of good splits you…

Good Way To Split

2 min read

Good Way To Split

2 min read


Nov 26, 2021

Permutations II

Given a collection of numbers, nums, that might contain duplicates, return all possible unique permutations in any order. Example 1: Input: nums = [1,1,2] Output: [[1,1,2], [1,2,1], [2,1,1]] Example 2: Input: nums = [1,2,3] Output: [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]] Constraints: 1 <= nums.length <= 8 -10 <= nums[i] <= 10 Solution : public class Solution…

Permutations

1 min read

Permutations

1 min read


Nov 24, 2021

Permutations

Given an array nums of distinct integers, return all the possible permutations. You can return the answer in any order. Example 1: Input: nums = [1,2,3] Output: [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]] Example 2: Input: nums = [0,1] Output: [[0,1],[1,0]] Example 3: Input: nums = [1] Output: [[1]] Constraints: 1 <= nums.length <= 6 …

Permutations

1 min read

Permutations

1 min read


Nov 23, 2021

Partition Equal Subset Sum.

Given a non-empty array nums containing only positive integers, find if the array can be partitioned into two subsets such that the sum of elements in both subsets is equal. Example 1: Input: nums = [1,5,11,5] Output: true Explanation: The array can be partitioned as [1, 5, 5] and [11]. …

Partitionequalsubsetsum

2 min read

Partitionequalsubsetsum

2 min read


Nov 19, 2021

Coin Change Problem

You are given an integer array coins representing coins of different denominations and an integer amount representing a total amount of money. Return the fewest number of coins that you need to make up that amount. …

Coin Change Problem

2 min read

Coin Change Problem

2 min read


Nov 4, 2021

Strange-advertising — HackerRank Problem

HackerLand Enterprise is adopting a new viral advertising strategy. When they launch a new product, they advertise it to exactly people on social media. On the first day, half of those people like the advertisement and each shares it with of their 3 friends. …

Strange Advertising

1 min read

Strange Advertising

1 min read


Jul 26, 2021

Maximum Swap

You are given an integer num. You can swap two digits at most once to get the maximum valued number.Return the maximum valued number you can get. Example 1: Input: num = 2736 Output: 7236 Explanation: Swap the number 2 and the number 7. Example 2: Input: num = 9973 Output…

Maximum Swap

2 min read

Maximum Swap

2 min read


Jul 24, 2021

Find the minimum number of swaps to sort unsorted array.

You are given an unordered array consisting of consecutive integers [1, 2, 3, …, n] without any duplicates. You are allowed to swap any two elements. Find the minimum number of swaps required to sort the array in ascending order. Example Perform the following steps: i arr…

Minium Swaps

2 min read

Minium Swaps

2 min read


Jul 22, 2021

Reverse Vowel of a String.

Given a string s, reverse only all the vowels in the string and return it. The vowels are 'a', 'e', 'i', 'o', and 'u', and they can appear in both cases. Example 1: Input: s = "hello" Output: "holle" Example 2: Input: s = "leetcode" Output: "leotcede" Constraints: 1 <=…

Reverse Vowels

2 min read

Reverse Vowel of a String.
Reverse Vowel of a String.
Reverse Vowels

2 min read

Vivek Singh

Vivek Singh

12 Followers

Software Architect

Help

Status

Writers

Blog

Careers

Privacy

Terms

About

Text to speech

Teams