From a4c6243fb4080ff9a54114a479fe364bbdb48e5e Mon Sep 17 00:00:00 2001 From: Jaskaran Singh Date: Fri, 7 Aug 2020 22:54:30 -0700 Subject: [PATCH 01/22] Set theme jekyll-theme-hacker --- _config.yml | 1 + index.md | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 _config.yml create mode 100644 index.md diff --git a/_config.yml b/_config.yml new file mode 100644 index 0000000..fc24e7a --- /dev/null +++ b/_config.yml @@ -0,0 +1 @@ +theme: jekyll-theme-hacker \ No newline at end of file diff --git a/index.md b/index.md new file mode 100644 index 0000000..7d89c34 --- /dev/null +++ b/index.md @@ -0,0 +1,37 @@ +## Welcome to GitHub Pages + +You can use the [editor on GitHub](https://github.com/TheCoderSingh/LeetCode-Solutions/edit/gh-pages/index.md) to maintain and preview the content for your website in Markdown files. + +Whenever you commit to this repository, GitHub Pages will run [Jekyll](https://jekyllrb.com/) to rebuild the pages in your site, from the content in your Markdown files. + +### Markdown + +Markdown is a lightweight and easy-to-use syntax for styling your writing. It includes conventions for + +```markdown +Syntax highlighted code block + +# Header 1 +## Header 2 +### Header 3 + +- Bulleted +- List + +1. Numbered +2. List + +**Bold** and _Italic_ and `Code` text + +[Link](url) and ![Image](src) +``` + +For more details see [GitHub Flavored Markdown](https://guides.github.com/features/mastering-markdown/). + +### Jekyll Themes + +Your Pages site will use the layout and styles from the Jekyll theme you have selected in your [repository settings](https://github.com/TheCoderSingh/LeetCode-Solutions/settings). The name of this theme is saved in the Jekyll `_config.yml` configuration file. + +### Support or Contact + +Having trouble with Pages? Check out our [documentation](https://docs.github.com/categories/github-pages-basics/) or [contact support](https://github.com/contact) and we’ll help you sort it out. From 676957e2b7e4cda3c35f709fc1f348344e8796fd Mon Sep 17 00:00:00 2001 From: Jaskaran Singh Date: Fri, 7 Aug 2020 22:55:11 -0700 Subject: [PATCH 02/22] Update index.md --- index.md | 53 ++++++++++++++++------------------------------------- 1 file changed, 16 insertions(+), 37 deletions(-) diff --git a/index.md b/index.md index 7d89c34..78422a9 100644 --- a/index.md +++ b/index.md @@ -1,37 +1,16 @@ -## Welcome to GitHub Pages - -You can use the [editor on GitHub](https://github.com/TheCoderSingh/LeetCode-Solutions/edit/gh-pages/index.md) to maintain and preview the content for your website in Markdown files. - -Whenever you commit to this repository, GitHub Pages will run [Jekyll](https://jekyllrb.com/) to rebuild the pages in your site, from the content in your Markdown files. - -### Markdown - -Markdown is a lightweight and easy-to-use syntax for styling your writing. It includes conventions for - -```markdown -Syntax highlighted code block - -# Header 1 -## Header 2 -### Header 3 - -- Bulleted -- List - -1. Numbered -2. List - -**Bold** and _Italic_ and `Code` text - -[Link](url) and ![Image](src) -``` - -For more details see [GitHub Flavored Markdown](https://guides.github.com/features/mastering-markdown/). - -### Jekyll Themes - -Your Pages site will use the layout and styles from the Jekyll theme you have selected in your [repository settings](https://github.com/TheCoderSingh/LeetCode-Solutions/settings). The name of this theme is saved in the Jekyll `_config.yml` configuration file. - -### Support or Contact - -Having trouble with Pages? Check out our [documentation](https://docs.github.com/categories/github-pages-basics/) or [contact support](https://github.com/contact) and we’ll help you sort it out. +# LeetCode Solved Problems + +| # | Title | Description | Solution | +| --- | --- | --- | --- | +| 1 | Two Sum | Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution, and you may not use the same element twice. | [Solution](twosum.js) | +| 7 | Reverse Integer | Given a 32-bit signed integer, reverse digits of an integer. | [Solution](reverse_integer.js) | +| 8 | String to Integer (atoi) | Implement atoi which converts a string to an integer. | [Solution](string_to_integer.js) | +| 65 | Valid Number | Validate if a given string can be interpreted as a decimal number. | [Solution](valid_number.js) | +| 665 | Non-decreasing Array | Given an array nums with n integers, your task is to check if it could become non-decreasing by modifying at most 1 element. We define an array is non-decreasing if nums[i] <= nums[i + 1] holds for every i (0-based) such that (0 <= i <= n - 2). | [Solution](non_decreasing_array.js) | +| 771 | Jewels and Stones | You're given strings J representing the types of stones that are jewels, and S representing the stones you have. Each character in S is a type of stone you have. You want to know how many of the stones you have are also jewels. The letters in J are guaranteed distinct, and all characters in J and S are letters. Letters are case sensitive, so "a" is considered a different type of stone from "A". | [Solution](jewels_and_stones.js) | +| 1108 | Defanging an IP Address | Given a valid (IPv4) IP address, return a defanged version of that IP address. A defanged IP address replaces every period "." with "[.]". | [Solution](ip_defanging.js) | +| 1281 | Subtract the Product and Sum of Digits of an Integer | Given an integer number n, return the difference between the product of its digits and the sum of its digits. | [Solution](subtract_product_and_sum_integer.js) | +| 1295 | Numbers with Even Number of Digits | Given an array nums of integers, return how many of them contain an even number of digits. | [Solution](numbers_even_number_of_digits.js) | +| 1313 | Decompress Run-Length Encoded List | We are given a list nums of integers representing a list compressed with run-length encoding. Consider each adjacent pair of elements [freq, val] = [nums[2*i], nums[2*i+1]] (with i >= 0). For each such pair, there are freq elements with value val concatenated in a sublist. Concatenate all the sublists from left to right to generate the decompressed list. | [Solution](decompress_run_length_encoded_list.js) | +| 1342 | Number of Steps to Reduce a Number to Zero | Given a non-negative integer num, return the number of steps to reduce it to zero. If the current number is even, you have to divide it by 2, otherwise, you have to subtract 1 from it. | [Solution](reduce_to_zero.js) | +| 1365 | How Many Numbers Are Smaller Than the Current Number | Given the array nums, for each nums[i] find out how many numbers in the array are smaller than it. That is, for each nums[i] you have to count the number of valid j's such that j != i and nums[j] < nums[i]. | [Solution](numbers_smaller_than_current.js) | From 714695c6810cfaec8fb3814daa1274f51bb3db38 Mon Sep 17 00:00:00 2001 From: Jaskaran Singh Date: Fri, 7 Aug 2020 22:56:34 -0700 Subject: [PATCH 03/22] Update index.md --- index.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/index.md b/index.md index 78422a9..e6dc964 100644 --- a/index.md +++ b/index.md @@ -3,7 +3,9 @@ | # | Title | Description | Solution | | --- | --- | --- | --- | | 1 | Two Sum | Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution, and you may not use the same element twice. | [Solution](twosum.js) | +| --- | --- | --- | --- | | 7 | Reverse Integer | Given a 32-bit signed integer, reverse digits of an integer. | [Solution](reverse_integer.js) | +| --- | --- | --- | --- | | 8 | String to Integer (atoi) | Implement atoi which converts a string to an integer. | [Solution](string_to_integer.js) | | 65 | Valid Number | Validate if a given string can be interpreted as a decimal number. | [Solution](valid_number.js) | | 665 | Non-decreasing Array | Given an array nums with n integers, your task is to check if it could become non-decreasing by modifying at most 1 element. We define an array is non-decreasing if nums[i] <= nums[i + 1] holds for every i (0-based) such that (0 <= i <= n - 2). | [Solution](non_decreasing_array.js) | From b062a60df5f820a8eefc46588aee911c53583781 Mon Sep 17 00:00:00 2001 From: Jaskaran Singh Date: Fri, 7 Aug 2020 23:02:03 -0700 Subject: [PATCH 04/22] Update index.md --- index.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/index.md b/index.md index e6dc964..78422a9 100644 --- a/index.md +++ b/index.md @@ -3,9 +3,7 @@ | # | Title | Description | Solution | | --- | --- | --- | --- | | 1 | Two Sum | Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution, and you may not use the same element twice. | [Solution](twosum.js) | -| --- | --- | --- | --- | | 7 | Reverse Integer | Given a 32-bit signed integer, reverse digits of an integer. | [Solution](reverse_integer.js) | -| --- | --- | --- | --- | | 8 | String to Integer (atoi) | Implement atoi which converts a string to an integer. | [Solution](string_to_integer.js) | | 65 | Valid Number | Validate if a given string can be interpreted as a decimal number. | [Solution](valid_number.js) | | 665 | Non-decreasing Array | Given an array nums with n integers, your task is to check if it could become non-decreasing by modifying at most 1 element. We define an array is non-decreasing if nums[i] <= nums[i + 1] holds for every i (0-based) such that (0 <= i <= n - 2). | [Solution](non_decreasing_array.js) | From 941e3e10c992349ec3159f1ffcbfd01de8d2c148 Mon Sep 17 00:00:00 2001 From: Jaskaran Singh Date: Sat, 31 Oct 2020 17:25:03 -0700 Subject: [PATCH 05/22] Set theme jekyll-theme-midnight --- _config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_config.yml b/_config.yml index fc24e7a..1885487 100644 --- a/_config.yml +++ b/_config.yml @@ -1 +1 @@ -theme: jekyll-theme-hacker \ No newline at end of file +theme: jekyll-theme-midnight \ No newline at end of file From 840a198748231f2b26e46b06dd9e1384088ea552 Mon Sep 17 00:00:00 2001 From: Jaskaran Singh Date: Sat, 31 Oct 2020 17:27:37 -0700 Subject: [PATCH 06/22] Add new changes --- index.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/index.md b/index.md index 78422a9..6c17cf1 100644 --- a/index.md +++ b/index.md @@ -6,7 +6,10 @@ | 7 | Reverse Integer | Given a 32-bit signed integer, reverse digits of an integer. | [Solution](reverse_integer.js) | | 8 | String to Integer (atoi) | Implement atoi which converts a string to an integer. | [Solution](string_to_integer.js) | | 65 | Valid Number | Validate if a given string can be interpreted as a decimal number. | [Solution](valid_number.js) | +| 595 | Big Countries | A country is big if it has an area of bigger than 3 million square km or a population of more than 25 million. Write a SQL solution to output big countries' name, population and area. | [Solution](big_countries.sql) | +| 620 | Not Boring Movies | Please write a SQL query to output movies with an odd numbered ID and a description that is not 'boring'. Order the result by rating.| [Solution](not_boring_movies.sql) | | 665 | Non-decreasing Array | Given an array nums with n integers, your task is to check if it could become non-decreasing by modifying at most 1 element. We define an array is non-decreasing if nums[i] <= nums[i + 1] holds for every i (0-based) such that (0 <= i <= n - 2). | [Solution](non_decreasing_array.js) | +| 709 | To Lower Case | Implement function ToLowerCase() that has a string parameter str, and returns the same string in lowercase. | [Solution](to_lower_case.js) | | 771 | Jewels and Stones | You're given strings J representing the types of stones that are jewels, and S representing the stones you have. Each character in S is a type of stone you have. You want to know how many of the stones you have are also jewels. The letters in J are guaranteed distinct, and all characters in J and S are letters. Letters are case sensitive, so "a" is considered a different type of stone from "A". | [Solution](jewels_and_stones.js) | | 1108 | Defanging an IP Address | Given a valid (IPv4) IP address, return a defanged version of that IP address. A defanged IP address replaces every period "." with "[.]". | [Solution](ip_defanging.js) | | 1281 | Subtract the Product and Sum of Digits of an Integer | Given an integer number n, return the difference between the product of its digits and the sum of its digits. | [Solution](subtract_product_and_sum_integer.js) | @@ -14,3 +17,6 @@ | 1313 | Decompress Run-Length Encoded List | We are given a list nums of integers representing a list compressed with run-length encoding. Consider each adjacent pair of elements [freq, val] = [nums[2*i], nums[2*i+1]] (with i >= 0). For each such pair, there are freq elements with value val concatenated in a sublist. Concatenate all the sublists from left to right to generate the decompressed list. | [Solution](decompress_run_length_encoded_list.js) | | 1342 | Number of Steps to Reduce a Number to Zero | Given a non-negative integer num, return the number of steps to reduce it to zero. If the current number is even, you have to divide it by 2, otherwise, you have to subtract 1 from it. | [Solution](reduce_to_zero.js) | | 1365 | How Many Numbers Are Smaller Than the Current Number | Given the array nums, for each nums[i] find out how many numbers in the array are smaller than it. That is, for each nums[i] you have to count the number of valid j's such that j != i and nums[j] < nums[i]. | [Solution](numbers_smaller_than_current.js) | +| 1431 | Kids With the Greatest Number of Candies| For each kid check if there is a way to distribute extraCandies among the kids such that he or she can have the greatest number of candies among them. Notice that multiple kids can have the greatest number of candies. | [Solution](greatest_number_of_candies.js) | +| 1470 | Shuffle the Array | 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]. | [Solution](shuffle_array.js) | +| 1480 | Running Sum of 1d Array | Given an array nums. We define a running sum of an array as runningSum[i] = sum(nums[0]…nums[i]). Return the running sum of nums. | [Solution](sum_1d_array.js) | | From 4de9ddd69b66b5f769973e2756d8353dd3f970d8 Mon Sep 17 00:00:00 2001 From: Jaskaran Singh Date: Fri, 14 May 2021 13:35:37 -0700 Subject: [PATCH 07/22] Set theme jekyll-theme-cayman --- _config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_config.yml b/_config.yml index 1885487..c419263 100644 --- a/_config.yml +++ b/_config.yml @@ -1 +1 @@ -theme: jekyll-theme-midnight \ No newline at end of file +theme: jekyll-theme-cayman \ No newline at end of file From f1f1f11d8dcbd03d467f9b5aea6c88816e43f652 Mon Sep 17 00:00:00 2001 From: Jaskaran Singh Date: Fri, 14 May 2021 16:54:53 -0700 Subject: [PATCH 08/22] Update index.md --- index.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/index.md b/index.md index 6c17cf1..2da3b8a 100644 --- a/index.md +++ b/index.md @@ -1,17 +1,23 @@ # LeetCode Solved Problems +### Go to https://thecodersingh.github.io/LeetCode-Solutions/ + | # | Title | Description | Solution | | --- | --- | --- | --- | | 1 | Two Sum | Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution, and you may not use the same element twice. | [Solution](twosum.js) | | 7 | Reverse Integer | Given a 32-bit signed integer, reverse digits of an integer. | [Solution](reverse_integer.js) | | 8 | String to Integer (atoi) | Implement atoi which converts a string to an integer. | [Solution](string_to_integer.js) | | 65 | Valid Number | Validate if a given string can be interpreted as a decimal number. | [Solution](valid_number.js) | +| 204 | Count Primes | Count the number of prime numbers less than a non-negative number, n. | [Solution](count_primes.js) | +| 344 | Reverse String | Write a function that reverses a string. The input string is given as an array of characters s. | [Solution](reverse_string.js) | | 595 | Big Countries | A country is big if it has an area of bigger than 3 million square km or a population of more than 25 million. Write a SQL solution to output big countries' name, population and area. | [Solution](big_countries.sql) | | 620 | Not Boring Movies | Please write a SQL query to output movies with an odd numbered ID and a description that is not 'boring'. Order the result by rating.| [Solution](not_boring_movies.sql) | | 665 | Non-decreasing Array | Given an array nums with n integers, your task is to check if it could become non-decreasing by modifying at most 1 element. We define an array is non-decreasing if nums[i] <= nums[i + 1] holds for every i (0-based) such that (0 <= i <= n - 2). | [Solution](non_decreasing_array.js) | | 709 | To Lower Case | Implement function ToLowerCase() that has a string parameter str, and returns the same string in lowercase. | [Solution](to_lower_case.js) | | 771 | Jewels and Stones | You're given strings J representing the types of stones that are jewels, and S representing the stones you have. Each character in S is a type of stone you have. You want to know how many of the stones you have are also jewels. The letters in J are guaranteed distinct, and all characters in J and S are letters. Letters are case sensitive, so "a" is considered a different type of stone from "A". | [Solution](jewels_and_stones.js) | +| 922 | Sort Array By Parity II | Given an array of integers nums, half of the integers in nums are odd, and the other half are even. Sort the array so that whenever nums[i] is odd, i is odd, and whenever nums[i] is even, i is even. Return any answer array that satisfies this condition. | [Solution](sort_array_parity.js) | | 1108 | Defanging an IP Address | Given a valid (IPv4) IP address, return a defanged version of that IP address. A defanged IP address replaces every period "." with "[.]". | [Solution](ip_defanging.js) | +| 1207 | Unique Number of Occurrences | Given an array of integers arr, write a function that returns true if and only if the number of occurrences of each value in the array is unique. | [Solution](unique_occurrences.js) | | 1281 | Subtract the Product and Sum of Digits of an Integer | Given an integer number n, return the difference between the product of its digits and the sum of its digits. | [Solution](subtract_product_and_sum_integer.js) | | 1295 | Numbers with Even Number of Digits | Given an array nums of integers, return how many of them contain an even number of digits. | [Solution](numbers_even_number_of_digits.js) | | 1313 | Decompress Run-Length Encoded List | We are given a list nums of integers representing a list compressed with run-length encoding. Consider each adjacent pair of elements [freq, val] = [nums[2*i], nums[2*i+1]] (with i >= 0). For each such pair, there are freq elements with value val concatenated in a sublist. Concatenate all the sublists from left to right to generate the decompressed list. | [Solution](decompress_run_length_encoded_list.js) | @@ -19,4 +25,6 @@ | 1365 | How Many Numbers Are Smaller Than the Current Number | Given the array nums, for each nums[i] find out how many numbers in the array are smaller than it. That is, for each nums[i] you have to count the number of valid j's such that j != i and nums[j] < nums[i]. | [Solution](numbers_smaller_than_current.js) | | 1431 | Kids With the Greatest Number of Candies| For each kid check if there is a way to distribute extraCandies among the kids such that he or she can have the greatest number of candies among them. Notice that multiple kids can have the greatest number of candies. | [Solution](greatest_number_of_candies.js) | | 1470 | Shuffle the Array | 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]. | [Solution](shuffle_array.js) | -| 1480 | Running Sum of 1d Array | Given an array nums. We define a running sum of an array as runningSum[i] = sum(nums[0]…nums[i]). Return the running sum of nums. | [Solution](sum_1d_array.js) | | +| 1480 | Running Sum of 1d Array | Given an array nums. We define a running sum of an array as runningSum[i] = sum(nums[0]…nums[i]). Return the running sum of nums. | [Solution](sum_1d_array.js) | +| 1486 | XOR Operation in an Array | Given an integer n and an integer start. Define an array nums where nums[i] = start + 2\*i (0-indexed) and n == nums.length. Return the bitwise XOR of all elements of nums. | [Solution](xor_array.js) | +| 1672 | Richest Customer Wealth | You are given an m x n integer grid accounts where accounts[i][j] is the amount of money the ith customer has in the jth bank. Return the wealth that the richest customer has. A customer's wealth is the amount of money they have in all their bank accounts. The richest customer is the customer that has the maximum wealth. | [Solution](richest_customer_wealth.js) | | From 34c94d0d636aecb3be62f427413251658d724b54 Mon Sep 17 00:00:00 2001 From: Jaskaran Singh Date: Fri, 14 May 2021 16:55:42 -0700 Subject: [PATCH 09/22] Update index.md --- index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.md b/index.md index 2da3b8a..5ca381b 100644 --- a/index.md +++ b/index.md @@ -1,6 +1,6 @@ # LeetCode Solved Problems -### Go to https://thecodersingh.github.io/LeetCode-Solutions/ +### Go to (https://thecodersingh.github.io/LeetCode-Solutions/) | # | Title | Description | Solution | | --- | --- | --- | --- | From 11c8e68ed9d1eceae858e7d44197a335716b7c78 Mon Sep 17 00:00:00 2001 From: Jaskaran Singh Date: Fri, 14 May 2021 16:56:03 -0700 Subject: [PATCH 10/22] Update index.md --- index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.md b/index.md index 5ca381b..46a481e 100644 --- a/index.md +++ b/index.md @@ -1,6 +1,6 @@ # LeetCode Solved Problems -### Go to (https://thecodersingh.github.io/LeetCode-Solutions/) +### Go to [https://thecodersingh.github.io/LeetCode-Solutions/](https://thecodersingh.github.io/LeetCode-Solutions/) | # | Title | Description | Solution | | --- | --- | --- | --- | From c50909285ab19b609b38ee2111735d0402d2a971 Mon Sep 17 00:00:00 2001 From: Jaskaran Singh Date: Fri, 14 May 2021 16:56:48 -0700 Subject: [PATCH 11/22] Update index.md --- index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.md b/index.md index 46a481e..e137f91 100644 --- a/index.md +++ b/index.md @@ -1,6 +1,6 @@ # LeetCode Solved Problems -### Go to [https://thecodersingh.github.io/LeetCode-Solutions/](https://thecodersingh.github.io/LeetCode-Solutions/) +### Go to [https://thecodersingh.github.io/LeetCode-Solutions/] | # | Title | Description | Solution | | --- | --- | --- | --- | From 2ab2f12bd767849e2a660fa36be4a1f1bf9f66ec Mon Sep 17 00:00:00 2001 From: Jaskaran Singh Date: Fri, 14 May 2021 16:57:21 -0700 Subject: [PATCH 12/22] Update index.md --- index.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/index.md b/index.md index e137f91..57ef4b6 100644 --- a/index.md +++ b/index.md @@ -1,7 +1,5 @@ # LeetCode Solved Problems -### Go to [https://thecodersingh.github.io/LeetCode-Solutions/] - | # | Title | Description | Solution | | --- | --- | --- | --- | | 1 | Two Sum | Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution, and you may not use the same element twice. | [Solution](twosum.js) | From b117d25020b8e7c03b90386bb063cc887bdaa559 Mon Sep 17 00:00:00 2001 From: Jaskaran Singh Date: Fri, 14 May 2021 18:11:15 -0700 Subject: [PATCH 13/22] Update index.md --- index.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/index.md b/index.md index 57ef4b6..a3a1a39 100644 --- a/index.md +++ b/index.md @@ -25,4 +25,7 @@ | 1470 | Shuffle the Array | 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]. | [Solution](shuffle_array.js) | | 1480 | Running Sum of 1d Array | Given an array nums. We define a running sum of an array as runningSum[i] = sum(nums[0]…nums[i]). Return the running sum of nums. | [Solution](sum_1d_array.js) | | 1486 | XOR Operation in an Array | Given an integer n and an integer start. Define an array nums where nums[i] = start + 2\*i (0-indexed) and n == nums.length. Return the bitwise XOR of all elements of nums. | [Solution](xor_array.js) | -| 1672 | Richest Customer Wealth | You are given an m x n integer grid accounts where accounts[i][j] is the amount of money the ith customer has in the jth bank. Return the wealth that the richest customer has. A customer's wealth is the amount of money they have in all their bank accounts. The richest customer is the customer that has the maximum wealth. | [Solution](richest_customer_wealth.js) | | +| 1512 | Number of Good Pairs | Given an array of integers nums. A pair (i,j) is called good if nums[i] == nums[j] and i < j. Return the number of good pairs. | [Solution](number_good_pairs.js) | +| 1528 | Shuffle String | Given a string s and an integer array indices of the same length. The string s will be shuffled such that the character at the ith position moves to indices[i] in the shuffled string. Return the shuffled string. | [Solution](shuffle_string.js) | +| 1603 | Design Parking System | Design a parking system for a parking lot. The parking lot has three kinds of parking spaces: big, medium, and small, with a fixed number of slots for each size. | [Solution](parking_system.js) | +| 1672 | Richest Customer Wealth | You are given an m x n integer grid accounts where accounts[i][j] is the amount of money the ith customer has in the jth bank. Return the wealth that the richest customer has. A customer's wealth is the amount of money they have in all their bank accounts. The richest customer is the customer that has the maximum wealth. | [Solution](richest_customer_wealth.js) | From d1f2d56579342256555994a79463870f53fd2bb3 Mon Sep 17 00:00:00 2001 From: Jaskaran Singh Date: Mon, 17 May 2021 01:35:25 -0700 Subject: [PATCH 14/22] Set theme jekyll-theme-minimal --- _config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_config.yml b/_config.yml index c419263..2f7efbe 100644 --- a/_config.yml +++ b/_config.yml @@ -1 +1 @@ -theme: jekyll-theme-cayman \ No newline at end of file +theme: jekyll-theme-minimal \ No newline at end of file From a53d809b3e6b1f1c109f87ba9b9d4aab5fdd41c1 Mon Sep 17 00:00:00 2001 From: Jaskaran Singh Date: Mon, 17 May 2021 01:36:30 -0700 Subject: [PATCH 15/22] Set theme jekyll-theme-cayman --- _config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_config.yml b/_config.yml index 2f7efbe..c419263 100644 --- a/_config.yml +++ b/_config.yml @@ -1 +1 @@ -theme: jekyll-theme-minimal \ No newline at end of file +theme: jekyll-theme-cayman \ No newline at end of file From 1a7aa20cf96e60e3df8a3c918a33b1a01b4abc8b Mon Sep 17 00:00:00 2001 From: Jaskaran Singh Date: Tue, 12 Mar 2024 02:00:51 -0700 Subject: [PATCH 16/22] Update index.md --- index.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/index.md b/index.md index a3a1a39..1788b8c 100644 --- a/index.md +++ b/index.md @@ -1,12 +1,23 @@ # LeetCode Solved Problems +### Go to https://thecodersingh.github.io/Leetcode-Javascript-Solutions/ + | # | Title | Description | Solution | | --- | --- | --- | --- | | 1 | Two Sum | Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution, and you may not use the same element twice. | [Solution](twosum.js) | | 7 | Reverse Integer | Given a 32-bit signed integer, reverse digits of an integer. | [Solution](reverse_integer.js) | | 8 | String to Integer (atoi) | Implement atoi which converts a string to an integer. | [Solution](string_to_integer.js) | +| 9 | Palindrome Number | Given an integer x, return true if x is a palindrome, and false otherwise. | [Solution](palindrome.js) | +| 12 | Integer to Roman | Given an integer, convert it to a roman numeral. | [Solution](integer_to_roman.js) | +| 13 | Roman to Integer | Given a roman numeral, convert it to an integer. | [Solution](roman_to_integer.js) | +| 14 | Longest Common Prefix | Find the longest common prefix string amongst an array of strings. | [Solution](longest_common_prefix.js) | +| 20 | Valid Parentheses | Given a string, determine if the input string is valid. | [Solution](valid_parentheses.js) | | 65 | Valid Number | Validate if a given string can be interpreted as a decimal number. | [Solution](valid_number.js) | +| 94 | Binary Tree Inorder Traversal | Given the root of a binary tree, return the inorder traversal of its nodes' values. | [Solution](binary_tree_inorder_traversal.js) | +| 104 | Maximum Depth of Binary Tree | Given the root of a binary tree, return its maximum depth. | [Solution](maximum_depth_binary_tree.js) | +| 175 | Combine Two Tables | Report the first name, last name, city, and state of each person in the table. | [Solution](combine_tables.sql) | | 204 | Count Primes | Count the number of prime numbers less than a non-negative number, n. | [Solution](count_primes.js) | +| 258 | Add Digits | Given an integer, repeatedly add all its digits until the result has only one digit. | [Solution](add_digits.js) | | 344 | Reverse String | Write a function that reverses a string. The input string is given as an array of characters s. | [Solution](reverse_string.js) | | 595 | Big Countries | A country is big if it has an area of bigger than 3 million square km or a population of more than 25 million. Write a SQL solution to output big countries' name, population and area. | [Solution](big_countries.sql) | | 620 | Not Boring Movies | Please write a SQL query to output movies with an odd numbered ID and a description that is not 'boring'. Order the result by rating.| [Solution](not_boring_movies.sql) | @@ -23,9 +34,10 @@ | 1365 | How Many Numbers Are Smaller Than the Current Number | Given the array nums, for each nums[i] find out how many numbers in the array are smaller than it. That is, for each nums[i] you have to count the number of valid j's such that j != i and nums[j] < nums[i]. | [Solution](numbers_smaller_than_current.js) | | 1431 | Kids With the Greatest Number of Candies| For each kid check if there is a way to distribute extraCandies among the kids such that he or she can have the greatest number of candies among them. Notice that multiple kids can have the greatest number of candies. | [Solution](greatest_number_of_candies.js) | | 1470 | Shuffle the Array | 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]. | [Solution](shuffle_array.js) | +| 1476 | Subrectangle Queries | Implement the class SubrectangleQueries which receives a rows x cols rectangle as a matrix of integers in the constructor and supports two methods. | [Solution](subrectangle_queries.js) | | 1480 | Running Sum of 1d Array | Given an array nums. We define a running sum of an array as runningSum[i] = sum(nums[0]…nums[i]). Return the running sum of nums. | [Solution](sum_1d_array.js) | | 1486 | XOR Operation in an Array | Given an integer n and an integer start. Define an array nums where nums[i] = start + 2\*i (0-indexed) and n == nums.length. Return the bitwise XOR of all elements of nums. | [Solution](xor_array.js) | | 1512 | Number of Good Pairs | Given an array of integers nums. A pair (i,j) is called good if nums[i] == nums[j] and i < j. Return the number of good pairs. | [Solution](number_good_pairs.js) | | 1528 | Shuffle String | Given a string s and an integer array indices of the same length. The string s will be shuffled such that the character at the ith position moves to indices[i] in the shuffled string. Return the shuffled string. | [Solution](shuffle_string.js) | | 1603 | Design Parking System | Design a parking system for a parking lot. The parking lot has three kinds of parking spaces: big, medium, and small, with a fixed number of slots for each size. | [Solution](parking_system.js) | -| 1672 | Richest Customer Wealth | You are given an m x n integer grid accounts where accounts[i][j] is the amount of money the ith customer has in the jth bank. Return the wealth that the richest customer has. A customer's wealth is the amount of money they have in all their bank accounts. The richest customer is the customer that has the maximum wealth. | [Solution](richest_customer_wealth.js) | +| 1672 | Richest Customer Wealth | You are given an m x n integer grid accounts where accounts[i][j] is the amount of money the ith customer has in the jth bank. Return the wealth that the richest customer has. A customer's wealth is the amount of money they have in all their bank accounts. The richest customer is the customer that has the maximum wealth. | [Solution](richest_customer_wealth.js) | | From eca2dc31ae14d1f7851f1dd1e386d6385a7b213b Mon Sep 17 00:00:00 2001 From: Jaskaran Singh Date: Tue, 12 Mar 2024 02:01:46 -0700 Subject: [PATCH 17/22] Update index.md --- index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.md b/index.md index 1788b8c..819f993 100644 --- a/index.md +++ b/index.md @@ -4,7 +4,7 @@ | # | Title | Description | Solution | | --- | --- | --- | --- | -| 1 | Two Sum | Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution, and you may not use the same element twice. | [Solution](twosum.js) | +| 1 | Two Sum | Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution, and you may not use the same element twice. | [Solution](twosum.js) | 7 | Reverse Integer | Given a 32-bit signed integer, reverse digits of an integer. | [Solution](reverse_integer.js) | | 8 | String to Integer (atoi) | Implement atoi which converts a string to an integer. | [Solution](string_to_integer.js) | | 9 | Palindrome Number | Given an integer x, return true if x is a palindrome, and false otherwise. | [Solution](palindrome.js) | From 6298feabd0ba7b6ff260aac8396a91cb5c45a0aa Mon Sep 17 00:00:00 2001 From: Jaskaran Singh Date: Tue, 12 Mar 2024 02:02:12 -0700 Subject: [PATCH 18/22] Update index.md --- index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.md b/index.md index 819f993..e73c33b 100644 --- a/index.md +++ b/index.md @@ -2,8 +2,8 @@ ### Go to https://thecodersingh.github.io/Leetcode-Javascript-Solutions/ -| # | Title | Description | Solution | -| --- | --- | --- | --- | +| # | Title | Description | Solution +| --- | --- | --- | --- | 1 | Two Sum | Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution, and you may not use the same element twice. | [Solution](twosum.js) | 7 | Reverse Integer | Given a 32-bit signed integer, reverse digits of an integer. | [Solution](reverse_integer.js) | | 8 | String to Integer (atoi) | Implement atoi which converts a string to an integer. | [Solution](string_to_integer.js) | From 8fdef74ae2530836828745a24530f695be493bd3 Mon Sep 17 00:00:00 2001 From: Jaskaran Singh Date: Tue, 12 Mar 2024 02:04:24 -0700 Subject: [PATCH 19/22] Update index.md --- index.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/index.md b/index.md index e73c33b..eeeab1a 100644 --- a/index.md +++ b/index.md @@ -1,10 +1,8 @@ # LeetCode Solved Problems -### Go to https://thecodersingh.github.io/Leetcode-Javascript-Solutions/ - -| # | Title | Description | Solution -| --- | --- | --- | --- -| 1 | Two Sum | Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution, and you may not use the same element twice. | [Solution](twosum.js) +| # | Title | Description | Solution | +| --- | --- | --- | --- | +| 1 | Two Sum | Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution, and you may not use the same element twice. | [Solution](twosum.js) | | 7 | Reverse Integer | Given a 32-bit signed integer, reverse digits of an integer. | [Solution](reverse_integer.js) | | 8 | String to Integer (atoi) | Implement atoi which converts a string to an integer. | [Solution](string_to_integer.js) | | 9 | Palindrome Number | Given an integer x, return true if x is a palindrome, and false otherwise. | [Solution](palindrome.js) | @@ -40,4 +38,4 @@ | 1512 | Number of Good Pairs | Given an array of integers nums. A pair (i,j) is called good if nums[i] == nums[j] and i < j. Return the number of good pairs. | [Solution](number_good_pairs.js) | | 1528 | Shuffle String | Given a string s and an integer array indices of the same length. The string s will be shuffled such that the character at the ith position moves to indices[i] in the shuffled string. Return the shuffled string. | [Solution](shuffle_string.js) | | 1603 | Design Parking System | Design a parking system for a parking lot. The parking lot has three kinds of parking spaces: big, medium, and small, with a fixed number of slots for each size. | [Solution](parking_system.js) | -| 1672 | Richest Customer Wealth | You are given an m x n integer grid accounts where accounts[i][j] is the amount of money the ith customer has in the jth bank. Return the wealth that the richest customer has. A customer's wealth is the amount of money they have in all their bank accounts. The richest customer is the customer that has the maximum wealth. | [Solution](richest_customer_wealth.js) | | +| 1672 | Richest Customer Wealth | You are given an m x n integer grid accounts where accounts[i][j] is the amount of money the ith customer has in the jth bank. Return the wealth that the richest customer has. A customer's wealth is the amount of money they have in all their bank accounts. The richest customer is the customer that has the maximum wealth. | [Solution](richest_customer_wealth.js) | From 07dbbcadc48682a9c6d418038b040c0b35a67f16 Mon Sep 17 00:00:00 2001 From: Jaskaran Singh Date: Tue, 12 Mar 2024 02:05:37 -0700 Subject: [PATCH 20/22] Update index.md --- index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.md b/index.md index eeeab1a..d398b53 100644 --- a/index.md +++ b/index.md @@ -1,4 +1,4 @@ -# LeetCode Solved Problems +# LeetCode Solutions | # | Title | Description | Solution | | --- | --- | --- | --- | From a0ed9818282f3eef8c47031eec4299fe800afec2 Mon Sep 17 00:00:00 2001 From: Jaskaran Singh Date: Mon, 29 Apr 2024 23:52:43 -0700 Subject: [PATCH 21/22] Update index.md --- index.md | 47 ++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 38 insertions(+), 9 deletions(-) diff --git a/index.md b/index.md index d398b53..834cdd7 100644 --- a/index.md +++ b/index.md @@ -2,30 +2,45 @@ | # | Title | Description | Solution | | --- | --- | --- | --- | -| 1 | Two Sum | Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution, and you may not use the same element twice. | [Solution](twosum.js) | +| 1 | Two Sum | Given an array of integers, return indices of the two numbers such that they add up to a specific target. | [Solution](twosum.js) | | 7 | Reverse Integer | Given a 32-bit signed integer, reverse digits of an integer. | [Solution](reverse_integer.js) | | 8 | String to Integer (atoi) | Implement atoi which converts a string to an integer. | [Solution](string_to_integer.js) | -| 9 | Palindrome Number | Given an integer x, return true if x is a palindrome, and false otherwise. | [Solution](palindrome.js) | +| 9 | Palindrome Number | Given an integer, return true if it is a palindrome, and false otherwise. | [Solution](palindrome.js) | | 12 | Integer to Roman | Given an integer, convert it to a roman numeral. | [Solution](integer_to_roman.js) | | 13 | Roman to Integer | Given a roman numeral, convert it to an integer. | [Solution](roman_to_integer.js) | | 14 | Longest Common Prefix | Find the longest common prefix string amongst an array of strings. | [Solution](longest_common_prefix.js) | | 20 | Valid Parentheses | Given a string, determine if the input string is valid. | [Solution](valid_parentheses.js) | | 65 | Valid Number | Validate if a given string can be interpreted as a decimal number. | [Solution](valid_number.js) | +| 66 | Plus One | Increment the large integer by one and return the resulting array of digits. | [Solution](plus_one.js) | | 94 | Binary Tree Inorder Traversal | Given the root of a binary tree, return the inorder traversal of its nodes' values. | [Solution](binary_tree_inorder_traversal.js) | | 104 | Maximum Depth of Binary Tree | Given the root of a binary tree, return its maximum depth. | [Solution](maximum_depth_binary_tree.js) | +| 125 | Valid Palindrome | Given a string s, return true if it is a palindrome, or false otherwise. | [Solution](valid_palindrome.js) | +| 136 | Single Number | Given a non-empty array of integers nums, every element appears twice except for one. Find that single one. | [Solution](single_number.js) | +| 141 | Linked List Cycle | Return true if there is a cycle in the linked list. Otherwise, return false. | [Solution](linked_list_cycle.js) | +| 167 | Two Sum II | Given a 1-indexed array of integers numbers that is already sorted in non-decreasing order, find two numbers such that they add up to a specific target number. Return the indices of the two numbers, added by one as an integer array of length 2. | [Solution](two_sum_ii.js) | +| 169 | Majority Element | Given an array nums of size n, return the majority element. | [Solution](majority_element.js) | | 175 | Combine Two Tables | Report the first name, last name, city, and state of each person in the table. | [Solution](combine_tables.sql) | | 204 | Count Primes | Count the number of prime numbers less than a non-negative number, n. | [Solution](count_primes.js) | +| 242 | Valid Anagram | Given two strings s and t, return true if t is an anagram of s, and false otherwise. | [Solution](valid_anagram.js) | | 258 | Add Digits | Given an integer, repeatedly add all its digits until the result has only one digit. | [Solution](add_digits.js) | +| 283 | Move Zeroes | Given an integer array, move all 0's to the end of it while maintaining the relative order of the non-zero elements. | [Solution](move_zeroes.js) | | 344 | Reverse String | Write a function that reverses a string. The input string is given as an array of characters s. | [Solution](reverse_string.js) | +| 349 | Intersection of Two Arrays | Given two integer arrays, return an array of their intersection. | [Solution](intersection_of_arrays.js) | +| 389 | Find the Difference | You are given two strings s and t. String t is generated by random shuffling string s and then add one more letter at a random position. Return the letter that was added to t. | [Solution](find_the_difference.js) | +| 448 | Find All Numbers Disappeared in an Array | Given an array of integers, return an array of all the integers that do not appear in nums. | [Solution](number_disappeared_in_array.js) | +| 584 | Find Customer Referee | Find the names of the customer that are not referred by the customer with id = 2. | [Solution](find_customer_referee.sql) | 595 | Big Countries | A country is big if it has an area of bigger than 3 million square km or a population of more than 25 million. Write a SQL solution to output big countries' name, population and area. | [Solution](big_countries.sql) | -| 620 | Not Boring Movies | Please write a SQL query to output movies with an odd numbered ID and a description that is not 'boring'. Order the result by rating.| [Solution](not_boring_movies.sql) | -| 665 | Non-decreasing Array | Given an array nums with n integers, your task is to check if it could become non-decreasing by modifying at most 1 element. We define an array is non-decreasing if nums[i] <= nums[i + 1] holds for every i (0-based) such that (0 <= i <= n - 2). | [Solution](non_decreasing_array.js) | +| 620 | Not Boring Movies | Write a SQL query to output movies with an odd numbered ID and a description that is not 'boring'.| [Solution](not_boring_movies.sql) | +| 665 | Non-decreasing Array | Given an array, check if it could become non-decreasing by modifying at most 1 element. | [Solution](non_decreasing_array.js) | +| 704 | Binary Search | Given an array of integers, write a function to search target in nums. | [Solution](binary_search.js) | | 709 | To Lower Case | Implement function ToLowerCase() that has a string parameter str, and returns the same string in lowercase. | [Solution](to_lower_case.js) | -| 771 | Jewels and Stones | You're given strings J representing the types of stones that are jewels, and S representing the stones you have. Each character in S is a type of stone you have. You want to know how many of the stones you have are also jewels. The letters in J are guaranteed distinct, and all characters in J and S are letters. Letters are case sensitive, so "a" is considered a different type of stone from "A". | [Solution](jewels_and_stones.js) | +| 771 | Jewels and Stones | You're given strings J representing the types of stones that are jewels, and S representing the stones you have. Each character in S is a type of stone you have. You want to know how many of the stones you have are also jewels. | [Solution](jewels_and_stones.js) | | 922 | Sort Array By Parity II | Given an array of integers nums, half of the integers in nums are odd, and the other half are even. Sort the array so that whenever nums[i] is odd, i is odd, and whenever nums[i] is even, i is even. Return any answer array that satisfies this condition. | [Solution](sort_array_parity.js) | -| 1108 | Defanging an IP Address | Given a valid (IPv4) IP address, return a defanged version of that IP address. A defanged IP address replaces every period "." with "[.]". | [Solution](ip_defanging.js) | -| 1207 | Unique Number of Occurrences | Given an array of integers arr, write a function that returns true if and only if the number of occurrences of each value in the array is unique. | [Solution](unique_occurrences.js) | -| 1281 | Subtract the Product and Sum of Digits of an Integer | Given an integer number n, return the difference between the product of its digits and the sum of its digits. | [Solution](subtract_product_and_sum_integer.js) | +| 933 | Number of Recent Calls | Return the number of requests that have happened in the inclusive range | [Solution](number_of_recent_calls.js) | +| 1108 | Defanging an IP Address | Given a valid IP address, return a defanged version of that IP address. | [Solution](ip_defanging.js) | +| 1148 | Article Views I | Write a solution to find all the authors that viewed at least one of their own articles. Return the result table sorted by id in ascending order. | [Solution](article_views_1.sql) | +| 1207 | Unique Number of Occurrences | Given an array of integers, write a function that returns true if and only if the number of occurrences of each value in the array is unique. | [Solution](unique_occurrences.js) | +| 1281 | Subtract the Product and Sum of Digits of an Integer | Given an integer, return the difference between the product of its digits and the sum of its digits. | [Solution](subtract_product_and_sum_integer.js) | | 1295 | Numbers with Even Number of Digits | Given an array nums of integers, return how many of them contain an even number of digits. | [Solution](numbers_even_number_of_digits.js) | | 1313 | Decompress Run-Length Encoded List | We are given a list nums of integers representing a list compressed with run-length encoding. Consider each adjacent pair of elements [freq, val] = [nums[2*i], nums[2*i+1]] (with i >= 0). For each such pair, there are freq elements with value val concatenated in a sublist. Concatenate all the sublists from left to right to generate the decompressed list. | [Solution](decompress_run_length_encoded_list.js) | | 1342 | Number of Steps to Reduce a Number to Zero | Given a non-negative integer num, return the number of steps to reduce it to zero. If the current number is even, you have to divide it by 2, otherwise, you have to subtract 1 from it. | [Solution](reduce_to_zero.js) | @@ -38,4 +53,18 @@ | 1512 | Number of Good Pairs | Given an array of integers nums. A pair (i,j) is called good if nums[i] == nums[j] and i < j. Return the number of good pairs. | [Solution](number_good_pairs.js) | | 1528 | Shuffle String | Given a string s and an integer array indices of the same length. The string s will be shuffled such that the character at the ith position moves to indices[i] in the shuffled string. Return the shuffled string. | [Solution](shuffle_string.js) | | 1603 | Design Parking System | Design a parking system for a parking lot. The parking lot has three kinds of parking spaces: big, medium, and small, with a fixed number of slots for each size. | [Solution](parking_system.js) | -| 1672 | Richest Customer Wealth | You are given an m x n integer grid accounts where accounts[i][j] is the amount of money the ith customer has in the jth bank. Return the wealth that the richest customer has. A customer's wealth is the amount of money they have in all their bank accounts. The richest customer is the customer that has the maximum wealth. | [Solution](richest_customer_wealth.js) | +| 1672 | Richest Customer Wealth | You are given an m x n integer grid accounts where accounts[i][j] is the amount of money the ith customer has in the jth bank. Return the wealth that the richest customer has. A customer's wealth is the amount of money they have in all their bank accounts. The richest customer is the customer that has the maximum wealth. | [Solution](richest_customer_wealth.js) | | +| 1683 | Invalid Tweets | Write a solution to find the IDs of the invalid tweets. The tweet is invalid if the number of characters used in the content of the tweet is strictly greater than 15. | [Solution](invalid_tweets.sql) | +| 1757 | Recyclable and Low Fat Products | Write a solution to find the ids of products that are both low fat and recyclable. | [Solution](recyclable_low_fat.sql) | +| 1920 | Build Array from Permutation | Given a zero-based permutation nums (0-indexed), build an array ans of the same length where ans[i] = nums[nums[i]] for each 0 <= i < nums.length and return it. | [Solution](array_from_permutation.js) +| 1929 | Concatenation of Array | Given an integer array nums of length n, you want to create an array ans of length 2n where ans[i] == nums[i] and ans[i + n] == nums[i] for 0 <= i < n (0-indexed). Specifically, ans is the concatenation of two nums arrays. Return the array ans. | [Solution](concatenation_of_array.js) | +| 2011 | Final Value of Variable After Performing Operations | Given an array of strings operations containing a list of operations, return the final value of X after performing all the operations. | [Solution](final_value.js) | +| 2114 | Maximum Number of Words Found in Sentences | Return the maximum number of words that appear in a single sentence. | [Solution](maximum_words.js) | +| 2235 | Add Two Integers | Given two integers num1 and num2, return the sum of the two integers. | [Solution](add_two_integers.js) | +| 2413 | Smallest Even Multiple | Given a positive integer n, return the smallest positive integer that is a multiple of both 2 and n. | [Solution](smallest_even_multiple.js) +| 2469 | Convert the Temperature | You should convert Celsius into Kelvin and Fahrenheit and return it as an array ans = [kelvin, fahrenheit]. | [Solution](convert_temperature.js) | +| 2703 | Return Length of Arguments Passed | Write a function argumentsLength that returns the count of arguments passed to it. | [Solution](length_of_arguments.js) | +| 2723 | Add Two Promises | Given two promises, return a new promise. The returned promise should resolve with the sum of the two numbers. | [Solution](add_two_promises.js) | +| 2769 | Find the Maximum Achievable Number | Return the maximum possible achievable number. | [Solution](maximum_achievable.js) | +| 2942 | Find Words Containing Character | You are given an array of strings words and a character. Return an array of indices representing the words that contain the character. | [Solution](words_containing_char.js) | +| 2951 | Find the Peaks | Return an array that consists of indices of peaks in the given array in any order. | [Solution](find_the_peaks.js) | From 19486102dc542650e5603b8789f35967cc5e2c39 Mon Sep 17 00:00:00 2001 From: Jaskaran Singh Date: Wed, 8 May 2024 17:20:59 -0700 Subject: [PATCH 22/22] Update index.md --- index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.md b/index.md index 834cdd7..a61def3 100644 --- a/index.md +++ b/index.md @@ -28,7 +28,7 @@ | 349 | Intersection of Two Arrays | Given two integer arrays, return an array of their intersection. | [Solution](intersection_of_arrays.js) | | 389 | Find the Difference | You are given two strings s and t. String t is generated by random shuffling string s and then add one more letter at a random position. Return the letter that was added to t. | [Solution](find_the_difference.js) | | 448 | Find All Numbers Disappeared in an Array | Given an array of integers, return an array of all the integers that do not appear in nums. | [Solution](number_disappeared_in_array.js) | -| 584 | Find Customer Referee | Find the names of the customer that are not referred by the customer with id = 2. | [Solution](find_customer_referee.sql) +| 584 | Find Customer Referee | Find the names of the customer that are not referred by the customer with id = 2. | [Solution](find_customer_referee.sql) | | 595 | Big Countries | A country is big if it has an area of bigger than 3 million square km or a population of more than 25 million. Write a SQL solution to output big countries' name, population and area. | [Solution](big_countries.sql) | | 620 | Not Boring Movies | Write a SQL query to output movies with an odd numbered ID and a description that is not 'boring'.| [Solution](not_boring_movies.sql) | | 665 | Non-decreasing Array | Given an array, check if it could become non-decreasing by modifying at most 1 element. | [Solution](non_decreasing_array.js) | @@ -62,7 +62,7 @@ | 2114 | Maximum Number of Words Found in Sentences | Return the maximum number of words that appear in a single sentence. | [Solution](maximum_words.js) | | 2235 | Add Two Integers | Given two integers num1 and num2, return the sum of the two integers. | [Solution](add_two_integers.js) | | 2413 | Smallest Even Multiple | Given a positive integer n, return the smallest positive integer that is a multiple of both 2 and n. | [Solution](smallest_even_multiple.js) -| 2469 | Convert the Temperature | You should convert Celsius into Kelvin and Fahrenheit and return it as an array ans = [kelvin, fahrenheit]. | [Solution](convert_temperature.js) | +| 2469 | Convert the Temperature | You should convert Celsius into Kelvin and Fahrenheit and return it as an array ans = (kelvin, fahrenheit). | [Solution](convert_temperature.js) | | 2703 | Return Length of Arguments Passed | Write a function argumentsLength that returns the count of arguments passed to it. | [Solution](length_of_arguments.js) | | 2723 | Add Two Promises | Given two promises, return a new promise. The returned promise should resolve with the sum of the two numbers. | [Solution](add_two_promises.js) | | 2769 | Find the Maximum Achievable Number | Return the maximum possible achievable number. | [Solution](maximum_achievable.js) |