Skip to content

Easy understand JS solutions for problems on leetcode which beats 90% at least. Hope you enjoy the journey of learning data structures and algorithms.

Notifications You must be signed in to change notification settings

kondalraodurgam/Leetcode-Solutions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 

Repository files navigation

Leetcode Problems and Solutions

A data structure is a named location that can be used to store and organize data. And, an algorithm is a collection of steps to solve a particular problem. Learning data structures and algorithms allow us to write efficient and optimized computer programs. Hope you enjoy the journey of learning data structures and algorithms.

Arrays are a simple data structure for storing lots of similar items. They exist in all programming languages, and are used as the basis for most other data structures. On their own, Arrays can be used to solve many interesting problems. Arrays come up very often in interview problems, and so being a guru with them is a must!

S.No Title Solution Time Space Difficulty
1619 Mean of Array After Removing Some Elements JavaScript O(n) O(n) Easy
27 Remove Element JavaScript O(n) O(1) Easy
1394 Find Lucky Integer in an Array JavaScript O(n) O(1) Easy
191 Number of 1 Bits JavaScript O(1) O(1) Easy
1365 How Many Numbers Are Smaller Than the Current Number JavaScript O(n) O(1) Easy
1491 Average Salary Excluding the Minimum and Maximum Salary JavaScript O(n) O(1) Easy
456 132 Pattern JavaScript O(n) O(1) Easy
482 License Key Formatting JavaScript O(n) O(1) Easy
1460 Make Two Arrays Equal by Reversing Sub-arrays JavaScript O(n) O(n) Easy
1629 Slowest Key JavaScript O(n) O(n) Easy
605 Can Place Flowers JavaScript O(n) O(n) Easy
228 Summary Ranges JavaScript O(n) O(n) Easy
1323 Maximum 69 Number JavaScript O(n) O(n) Easy
1636 Sort Array by Increasing Frequency JavaScript O(n) O(1) Easy
169 Majority Element JavaScript O(n) O(1) Easy
26 Remove Duplicates from Sorted Array JavaScript O(n) O(1) Easy
832 Flipping an Image JavaScript O(n) O(1) Easy
1475 Final Prices With a Special Discount in a Shop JavaScript O(n^2) O(n) Easy

Be familiar with the basic operations in a string, especially the unique operations which we don't have in an array Understand the differences between different comparison functions.

Determine whether the string is immutable or not in your favorite language and understand the impact of this feature.

Be able to solve basic string-related problems.

S.No Title Solution Time Space Difficulty
7 Reverse Integer JavaScript O(n) O(1) Easy
28 Implement strStr() JavaScript O(n^2) O(1) Easy
67 Add Binary JavaScript O(n) O(1) Easy
14 Longest Common Prefix JavaScript O(n^2) O(1) Easy
344 Reverse String JavaScript O(n) O(1) Easy
485 Max Consecutive Ones JavaScript O(n) O(1) Easy
S.No Title Solution Time Space Difficulty
1025 Divisor Game JavaScript O(1) O(1) Easy

Hash Table is a data structure which organizes data using hash functions in order to support quick insertion and search.

There are two different kinds of hash tables: hash set and hash map.

The hash set is one of the implementations of a set data structure to store no repeated values. The hash map is one of the implementations of a map data structure to store (key, value) pairs. It is easy to use a hash table with the help of standard template libraries. Most common languages such as Java, C++ and Python support both hash set and hash map.In Javascript Map and Set

By choosing a proper hash function, the hash table can achieve wonderful performance in both insertion and search.

S.No Title Solution Time Space Difficulty
1 Two Sum JavaScript O(n) O(1) Easy
575 Distribute Candies JavaScript O(1) O(1) Easy
204 Count Primes JavaScript O(n) O(1) Easy
1365 How Many Numbers Are Smaller Than the Current Number JavaScript O(n) O(1) Easy
136 Single Number JavaScript O(n) O(1) Easy

What is Binary Search? Binary Search is one of the most fundamental and useful algorithms in Computer Science. It describes the process of searching for a specific value in an ordered collection.

Terminology used in Binary Search:

Target - the value that you are searching for Index - the current location that you are searching Left, Right - the indicies from which we use to maintain our search Space Mid - the index that we use to apply a condition to determine if we should search left or right.

S.No Title Solution Time Space Difficulty
704 Binary Search JavaScript O(log(n)) O(1) Easy
35 Search Insert Position JavaScript O(log(n)) O(1) Easy
S.No Title Solution Time Space Difficulty
1221 Split a String in Balanced Strings JavaScript O(n) O(1) Easy
1486 XOR Operation in an Array JavaScript O(1) O(1) Easy
S.No Title Solution Time Space Difficulty
70 Climbing Stairs JavaScript O(n) O(1) Easy

Recursion is an important concept in computer science. It is a foundation for many other algorithms and data structures. However, the concept of recursion can be tricky to grasp for many beginners.

S.No Title Solution Time Space Difficulty
344 Reverse String JavaScript O(n) O(1) Easy

About

Easy understand JS solutions for problems on leetcode which beats 90% at least. Hope you enjoy the journey of learning data structures and algorithms.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published