Open in app

Sign In

Write

Sign In

Nhut Nguyen
Nhut Nguyen

1.5K Followers

Home

Lists

About

Published in

LeetSolve

·Jul 4

How To Solve Coding Challenge 1647. Minimum Deletions to Make Character Frequencies Unique

An example of frequency sorting — Problem statement A string s is called good if there are no two different characters in s that have the same frequency. Given a string s, return the minimum number of characters you need to delete to make s good. The frequency of a character in a string is the number of…

Cpp

3 min read

How To Solve Coding Challenge 1647. Minimum Deletions to Make Character Frequencies Unique
How To Solve Coding Challenge 1647. Minimum Deletions to Make Character Frequencies Unique
Cpp

3 min read


Published in

LeetSolve

·Jun 27

How To Solve Coding Challenge 1710. Maximum Units on a Truck

How to compare two vectors — Problem statement You are assigned to put some amount of boxes onto one truck. You are given a 2D array boxTypes, where boxTypes[i] = [numberOfBoxes_i, numberOfUnitsPerBox_i]: numberOfBoxes_i is the number of boxes of type i. numberOfUnitsPerBox_i is the number of units in each box of the type i. You are also given…

Cpp

3 min read

How To Solve Coding Challenge 1710. Maximum Units on a Truck
How To Solve Coding Challenge 1710. Maximum Units on a Truck
Cpp

3 min read


Published in

LeetSolve

·Jun 19

C++ Solution to Coding Challenge 3. Longest Substring Without Repeating Characters

How to find substrings without repeating characters — Problem statement 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 a length of 3. Example 2 Input: s = "bbbbb" Output: 1 Explanation: The answer is "b", with the length of 1. Example 3 Input: s = "pwwkew" Output…

Cpp

3 min read

C++ Solution to Coding Challenge 3. Longest Substring Without Repeating Characters
C++ Solution to Coding Challenge 3. Longest Substring Without Repeating Characters
Cpp

3 min read


Published in

LeetSolve

·Jun 12

The Math Behind Coding Challenge 279. Perfect Squares

When advanced mathematics comes to solving a coding problem — Problem statement Given an integer n, return the least number of perfect square numbers that sum to n. A perfect square is an integer that is the square of an integer; in other words, it is the product of some integer with itself. …

Cpp

6 min read

The Math Behind Coding Challenge 279. Perfect Squares
The Math Behind Coding Challenge 279. Perfect Squares
Cpp

6 min read


Published in

LeetSolve

·Jun 6

C++ Solution to Coding Challenge 48. Rotate Image

How to rotate a matrix — Problem statement You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise). You have to rotate the image in-place, which means you have to modify the input 2D matrix directly. DO NOT allocate another 2D matrix and do the rotation. Example 1

Cpp

2 min read

C++ Solution to Coding Challenge 48. Rotate Image
C++ Solution to Coding Challenge 48. Rotate Image
Cpp

2 min read


Published in

LeetSolve

·May 29

C++ Solution to Coding Challenge 565. Array Nesting

How to compute the longest cycle in a permutation — Problem statement You are given an integer array nums of length n where nums is a permutation of the numbers in the range [0, n - 1]. You should build a set s[k] = {nums[k], nums[nums[k]], nums[nums[nums[k]]], ... } subjected to the following rule: The first element in s[k] starts with the…

Cpp

3 min read

C++ Solution to Coding Challenge 565. Array Nesting
C++ Solution to Coding Challenge 565. Array Nesting
Cpp

3 min read


Published in

LeetSolve

·May 23

How To Solve Coding Challenge 165. Compare Version Numbers

With Complete Code in C++, Explanation, Complexity Analysis and Discussion — Problem statement Given two version numbers, version1 and version2, compare them. Version numbers consist of one or more revisions joined by a dot '.'. Each revision consists of digits and may contain leading zeros. Every revision contains at least one character. …

Cpp

3 min read

How To Solve Coding Challenge 165. Compare Version Numbers
How To Solve Coding Challenge 165. Compare Version Numbers
Cpp

3 min read


Published in

LeetSolve

·May 15

How To Solve Coding Challenge 1288. Remove Covered Intervals

How std::vectors are ordered in C++ — Problem statement Given an array intervals where intervals[i] = [li, ri] represent the interval [li, ri), remove all intervals that are covered by another interval in the list. The interval [a, b) is covered by the interval [c, d) if and only if c <= a and b <= d. Return the…

Cpp

3 min read

How To Solve Coding Challenge 1288. Remove Covered Intervals
How To Solve Coding Challenge 1288. Remove Covered Intervals
Cpp

3 min read


Published in

LeetSolve

·May 8

How To Solve Coding Challenge 242. Valid Anagram

With Complete Code in C++, Explanation, Complexity Analysis and Discussion — Problem statement Given two strings s and t, return true if t is an anagram of s, and false otherwise. An Anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once. Example 1 Input: s = "anagram", t =…

Cpp

3 min read

How To Solve Coding Challenge 242. Valid Anagram
How To Solve Coding Challenge 242. Valid Anagram
Cpp

3 min read


Published in

LeetSolve

·May 1

C++ Solution To Coding Challenge 739. Daily Temperatures

How a reversed iteration can improve performance — Problem statement Given an array of integers temperatures representing the daily temperatures, return an array answer such that answer[i] is the number of days you have to wait after the i-th day to get a warmer temperature. …

Cpp

4 min read

C++ Solution To Coding Challenge 739. Daily Temperatures
C++ Solution To Coding Challenge 739. Daily Temperatures
Cpp

4 min read

Nhut Nguyen

Nhut Nguyen

1.5K Followers

Programmer. Author. https://store.nhutnguyen.com/

Help

Status

Writers

Blog

Careers

Privacy

Terms

About

Text to speech

Teams