My code collection of 100 Days Of Coding Challenge!
-
Rangoli Generative Art :
JavaScript project created on the auspicious day of Diwali festival ✨, to celebrate Rangoli 🌸 in a Digital manner using Generative Art. -
Tic Tac Toe :
A fun little game created in JavaScript 🔥 with an elegant modern design! 🌸 -
Jump Game LeetCode : 🐸
We are initially positioned at the array's first index, and each element in the array represents your maximum jump length at that position. Return true if we can reach the last index, or false otherwise. -
Maximum Bags With Full Capacity of Rocks LeetCode : 💰
We are given two arrays capacity and rocks. The ith bag can hold a maximum of capacity[i] rocks and currently contains rocks[i] rocks. We are also given an integer additionalRocks, we can place it in any of the bags. Return the maximum number of bags that could have full capacity after placing the additional rocks in some bags. -
Remove Stones to Minimize the Total LeetCode : 🍪
We are given an array piles, where piles[i] is number of stones in ith pile, and an integer k. Choose any piles[i] and remove floor(piles[i] / 2) stones from it. We should apply this operation exactly k times and return the minimum possible total number of stones. -
Regular Expression Matching LeetCode : 😃!=😭
Given an input string s and a pattern p, implement regular expression matching with'.'for any single character and'*'for zero or more of the preceding element. The matching should cover the entire input string (not partial) and return true or false. -
Design Circular Queue LeetCode : ♻️
Design circular queue, it is a linear data structure, which follows FIFO (First In First Out) principle, and the last position is connected back to the first position to make a circle. It is also called "Ring Buffer". By using circular queue, we can utlize empty spaces in front of the queue. -
Word Pattern LeetCode : 🧩
Given a pattern and a string s, find if s follows the same pattern. Here follow means a full match, such that there is a bijection between a letter in pattern and a non-empty word in s. -
Detect Capital LeetCode : 📜
We define the usage of capitals in a word to be right when one of the case is followed: all letters capital, all letters not capital or only first letter capital. Given a stringword, returntrueif the usage of capitals is right. -
Container With Most Water LeetCode : 💧
Given an arrayheightof lengthn. There are n vertical lines drawn such that the two endpoints of theithline are(i, 0)and(i, height[i]). Find two lines that together with the x-axis form a container, such that it contains the most water. Return the maximum amount of water a container can store. -
Delete Columns to Make Sorted LeetCode : 🗑️
Given an array ofnstringsstrs, all of the same length. The strings could form a grid. For example,strs=["abc", "bce", "cae"]. We want to delete the columns that are not sorted lexicographically and return the number of columns. -
Minimum Rounds to Complete All Tasks LeetCode : 🔁✅
Given an arraytasks, wheretasks[i]represents the difficulty level of a task. In each round, you can complete either 2 or 3 tasks of the same difficulty level. Return the minimum rounds required to complete all the tasks, or-1if it is not possible to complete all the tasks. -
Largest Number LeetCode : 💯
Given a list of non-negative integersnums, arrange them such that they form the largest number and return it. Since the result may be very large, so we need to return a string instead of an integer. -
Minimum Number of Arrows to Burst Balloons LeetCode : 🎯🎈
There are some spherical balloons taped onto a flat wall. The balloons are represented as a 2D integer array, where each element represents a range on the x-axis. Arrows can be shot up from the x-axis to burst the balloons. Find the minimum number of arrows needed to burst all the balloons. -
Sort the People LeetCode : 🔢👥
Given an array of strings names, and an array heights that consists of distinct positive integers. Both arrays are of length n. For each indexi,names[i]andheights[i]denote the name and height of theithperson. Return names sorted in descending order of heights. -
Maximum Ice Cream Bars LeetCode : 😋🍦
On a summer day, a boy wants to buy some ice cream bars. Given an array costs of lengthn, wherecosts[i]is the price of theithice cream bar in coins. The boy initially has coins to spend, and he wants to buy as many ice cream bars as possible. Return the maximum number of ice cream bars the boy can buy with coins. -
Plus One LeetCode : 👍
Given a large integer represented as an integer array digits, where eachdigits[i]is theithdigit of the integer. The digits are ordered from most significant to least significant in left-to-right order. The large integer does not contain any leading0's. Increment the large integer by one and return the resulting array of digits. -
Gas Station LeetCode : ⛽
Given two arrays representing a circular journey withngas stations:gasandcost. Our car has an unlimited gas tank and it costs a certain amount of gas to travel from one station to the next. Find the index of the gas station where we can start the journey and complete the circuit once. Return-1if it is not possible. -
Keyboard Row LeetCode : 💻
Given an array of stringswords, return the words that can be typed using letters of the alphabet on only one row of American keyboard like: first row is"qwertyuiop", second row is"asdfghjkl", and third row is"zxcvbnm". -
Max Points on a Line LeetCode : 🔢📏
Given an array ofpointswherepoints[i] = [xi, yi]represents a point on the X-Y plane, return the maximum number of points that lie on the same straight line. -
Minimum Difference Between Highest and Lowest of K Scores LeetCode : 🔼🔽
Given an arraynums, wherenums[i]represents the score of theithstudent, with an integerk. Pick the scores of anykstudents from the array so that the difference between the highest and the lowest of thekscores is minimized. Return the minimum possible difference. -
Binary Tree Preorder Traversal LeetCode : 🌳👈👉
Given therootof a binary tree, return the preorder traversal of its nodes' values. -
Maximum Average Subarray I LeetCode : ⏫⏳
Given an integer arraynumsconsisting ofnelements, and an integerk. Find a contiguous subarray whose length is equal tokthat has the maximum average value and return this value. Any answer with a calculation error less than10-5will be accepted. -
Same Tree LeetCode : 🌳🌳
Given the roots of two binary treespandq, write a function to check if they are the same or not. Two binary trees are considered the same if they are structurally identical, and the nodes have the same value. -
Contains Duplicate II LeetCode : 🔍🔎
Given an integer arraynumsand an integerk, returntrueif there are two distinct indicesiandjin the array such thatnums[i] == nums[j]andabs(i - j) <= k. -
Minimum Time to Collect All Apples in a Tree LeetCode : 🍎🏃
Given an undirected tree consisting ofnvertices numbered from0ton-1, which has some apples in their vertices. You spend 1 second to walk over one edge of the tree. Return the minimum time in seconds you have to spend to collect all apples in the tree, starting at vertex 0 and coming back to this vertex. -
Intersection of Two Arrays LeetCode : ⋂
Given two integer arraysnums1andnums2, return an array of their intersection. Each element in the result must be unique and you may return the result in any order. -
Number of Nodes in the Sub-Tree With the Same Label LeetCode : 🌳🔍🎨
Given a tree with n nodes labeled by lower-case characters. Each node has a label specified in the stringlabels, and the edges of the tree are given in the arrayedges. The task is to return an array of sizen, where each element is the number of nodes in the subtree of the corresponding node that have the same label as the node itself. -
Max Consecutive Ones III LeetCode : 📈1️⃣
Given a binary arraynumsand an integerk, return the maximum number of consecutive1's in the array if you can flip at mostk0's. -
Longest Path With Different Adjacent Characters LeetCode : 🌲🛣️🌳
Given a tree represented by an array and a string, find the longest path in the tree such that no two adjacent nodes on the path have the same character assigned to them. -
Grumpy Bookstore Owner LeetCode : 😠📚
Given an arraycustomersand an arraygrumpy, wheregrumpy[i]is1if the bookstore owner is grumpy during theithminute and0otherwise. The bookstore owner knows a secret technique to keep themselves not grumpy for a certain number ofminutes, but can only use it once. Return the maximum number of customers that can be satisfied throughout the day. -
Lexicographically Smallest Equivalent String LeetCode : 📝📊🔤
Given two strings of the same lengths1ands2and a stringbaseStr, using the equivalency information froms1ands2, return the lexicographically smallest equivalent string ofbaseStr. -
Best Time to Buy and Sell Stock LeetCode : 💰📈📉
Maximize profit by buying and selling a stock on different days, return max profit or 0 if none. -
Number of Good Paths LeetCode : 🛣️
Find the number of good paths in a tree, where a good path starts and ends at nodes with the same value and all nodes in between have values less than or equal to the starting node's value. The input is an array of node values and an array of edges representing the tree structure. -
Number of Arithmetic Triplets LeetCode : 🔢📊
Find the number of unique arithmetic triplets(i, j, k)in a strictly increasing integer array wherenums[j] - nums[i] == diffandnums[k] - nums[j] == diff. -
Insert Interval LeetCode : ⬇️⌛
The task is to insert a new interval into a given sorted array of non-overlapping intervals and merge any overlapping intervals if necessary, while keeping the array sorted. -
Flipping an Image LeetCode : 👆👇
Given an n x n binary matrix image, flip the image horizontally, then invert it, and return the resulting image.
E.g.[1,1,0]->[0,1,1]->[1,0,0] -
Flip String to Monotone Increasing LeetCode : 0️⃣1️⃣📈
Given a binary string, flip the least number of times to make it monotone increasing (consists of 0's followed by 1's) and return that count. -
Find First Palindromic String in the Array LeetCode : 🔍🔁
Given an array of stringswords, return the first palindromic string in the array. If there is no such string, return an empty string"". -
Maximum Sum Circular Subarray LeetCode : 🔝💰🌀
Given a circular integer arraynumsof lengthn, return the maximum possible sum of a non-empty subarray ofnums. -
Maximum Count of Positive Integer and Negative Integer LeetCode : 📊
Get the maximum count of positive and negative integers in a given array and return the maximum count. -
Binary Search LeetCode : 1️⃣➗2️⃣
Given an array of integers nums which is sorted in ascending order, and an integer target, write a function to search target in nums. If target exists, then return its index. Otherwise, return -1. -
Subarray Sums Divisible by K LeetCode : 🔢🔍
Given an integer arraynumsand an integerk, return the number of non-empty subarrays that have a sum divisible byk. A subarray is a contiguous part of an array. -
Count Number of Nice Subarrays LeetCode : 🧮📊
Given an array of integersnumsand an integerk. A continuous subarray is called nice if there arekodd numbers on it. Return the number of nice sub-arrays. -
Non-decreasing Subsequences LeetCode : 📈
Given an integer arraynums, return all the different possible non-decreasing subsequences of the given array with at least two elements. You may return the answer in any order. -
Sum of All Subset XOR Totals LeetCode : ⨁
Given an array of integers, return the sum of XOR of all subsets. Count subsets with same elements multiple times. -
Restore IP Addresses LeetCode : 🛠️🌐
A valid IP address consists of 4 integers between 0 and 255, separated by dots, no leading zeros. Given a string of digits, return all possible valid IP addresses that can be formed by inserting dots, no reordering or removing digits in the string. -
Palindrome Partitioning LeetCode : 🔄🔨🧱
Given a strings, partitionssuch that every substring of the partition is a palindrome. Return all possible palindrome partitioning ofs. -
Assign Cookies LeetCode : 🍪
You want to give your children cookies, with each child getting at most one. Each child has a "greed factor" for cookie size, and you have cookies of various sizes. You want to assign the cookies to the children to make the most content children. -
Minimum Common Value LeetCode : 📜🔘📃
Given two sorted integer arrays, return minimum common integer from sorted arraysnums1andnums2, or-1if none. -
Find the Town Judge LeetCode : 🏛️
Find the town judge amongnpeople, using trust arraytrust[i]=[ai, bi]. Return their label if they trust no one and are trusted by everyone except themselves, else return-1. -
Predict the Winner LeetCode : 🏆
Given an integer arraynums, two players take turns choosing numbers from either end of the array, adding to their score until the array is empty. Return true if Player 1 can win assuming optimal play. -
Snakes and Ladders LeetCode : 🐍🎲🪜
Find the minimum number of moves to reach the end of a snakes and ladders board where each cell is labeled in a Boustrophedon style. The algorithm uses breadth-first search and returns-1if the end cannot be reached. -
Find Closest Node to Given Two Nodes LeetCode : 🎱
↔️ ⭕
Given a directed graph with n nodes, represented by an array of edges and two starting nodes, find the closest node that can be reached from both nodes with minimized maximum distance. If multiple answers, return smallest index. Return -1 if no possible answer. -
Reverse Linked List LeetCode : 🔙🔗📜
Given the head of a singly linked list, reverse the list, and return the reversed list. -
Cheapest Flights Within K Stops LeetCode : ✈
Find the cheapest route fromsrctodstwith at mostkstops amongncities connected by flights, return-1if no such route exists. -
Roman to Integer LeetCode : ➡️🔢
Given a roman numeral, convert it to an integer. Roman numerals have 7 symbols: I, V, X, L, C, D, M. Each symbol represents a different value. The algorithm for converting Roman numerals to integers is adding together the values of each symbol, handling special cases of subtraction such as IV and IX. -
Missing Number LeetCode : ❓
Given an arraynumscontainingndistinct numbers in the range[0, n], return the only number in the range that is missing from the array. -
Concatenated Words LeetCode :
▶️ ⏩
Given an array of stringswords(without duplicates), return all the concatenated words in the given list ofwords. A concatenated word is defined as a string that is comprised entirely of at least two shorter words in the given array. -
Data Stream as Disjoint Intervals LeetCode : 📊📈🔳🔲
Implement aSummaryRangesclass that can: Initialize with an empty stream, add integers to the stream and return a summary of the integers in the stream as a list of disjoint intervals, sorted by start interval. -
Closest Prime Numbers in Range LeetCode : 3️⃣⏩5️⃣
Find the closest prime numbers betweenleftandright, where closest is defined as minimum difference between the two prime numbers. Return the pair as an array or[-1, -1]if no such pair exists. Prime numbers are defined as numbers only divisible by1and themselves. -
LFU Cache LeetCode : 💾
Design and implement a LFU cache data structure. Implement theLFUCacheclass withgetandputmethods that haveO(1)time complexity. -
Sqrt(x) LeetCode : 🧮🔢
Find square root of x rounded down to nearest integer. No built-in functions or operators allowed. -
Happy Number LeetCode : 😊
Determine if a number is happy by summing its digits' squares and repeating until 1 or an endless cycle. Return true if it ends in 1, false otherwise. -
N-th Tribonacci Number LeetCode : 🔢🔄
The Tribonacci sequence is defined as: T0 = 0, T1 = 1, T2 = 1, Tn+3 = Tn+Tn+1+Tn+2 forn >= 0. Givenn, return Tn. -
Climbing Stairs LeetCode : 🪜
You are climbing a staircase. It takes n steps to reach the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top? -
Best Team With No Conflicts LeetCode : 🏆⚽️💪
You're a basketball manager. For a tournament, you want to pick the team with the highest score by summing the scores of all players. Conflicts occur when a younger player has a higher score than an older player. Choose the best team with no conflicts using lists of player scores and ages. -
Fizz Buzz LeetCode : 💥🔊
Return a string array of "FizzBuzz" ifiis divisible by3&5, "Fizz" if divisible by3, "Buzz" if divisible by5, ori(as string) for allifrom1ton, indexed 1-based. -
Greatest Common Divisor of Strings LeetCode : 📈➗️🔡
Find largest stringxthat divides bothstr1andstr2. If t divides s,s = t + ... + t(t repeated one or more times). -
Power of Three LeetCode : 💡️⚡️3️⃣
Given an integern, returntrueif it is a power of three. Otherwise, returnfalse. An integernis a power of three, if there exists an integerxsuch thatn == 3x. -
Zigzag Conversion LeetCode : ⚡💭
Write code to convert string"PAYPALISHIRING"to"PAHNAPLSIIGYIR"using zigzag pattern given number of rows:string convert(string s, int numRows) -
Permutation in String LeetCode : 🔄🧵
Given two stringss1ands2, returntrueifs2contains a permutation ofs1, orfalseotherwise. In other words, returntrueif one ofs1's permutations is the substring ofs2. -
Find All Anagrams in a String LeetCode : 🔍🔀🔤
Given two stringssandp, return an array of all the start indices ofp's anagrams ins. You may return the answer in any order. 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. -
Fruit Into Baskets LeetCode : 🍇🍉🍎🛍️
Two baskets are given to collect fruit from a row of trees, represented by anarrayfruits. Each basket can only hold one type of fruit, with no limit on the amount. You must pick one fruit from each tree as you move from left to right, and stop when you reach a fruit that won't fit in the baskets. The goal is to pick the maximum number of fruits. -
Jump Game II LeetCode : 🏃♂️🎮2️⃣
Given a 0-indexed arraynumsof lengthn, starting atnums[0]. Eachnums[i]is the max jump length fromitoi + j(where0 <= j <= nums[i]andi + j < n). Return minimum number of jumps to reachnums[n - 1]. Assumed to always have a solution. -
Naming a Company LeetCode : 📝💡🏢
Given an array of stringsideasrepresenting company names, find the number of distinct names formed by swapping the first letters of two names and concatenating them if they are not in the originalideaslist. -
As Far from Land as Possible LeetCode : 🌊🏃♂️🏝️
Find max Manhattan distance from water cell to nearest land cell in ann x ngrid of0s (water) and1s (land). Return distance or-1if no water or land exists. -
Intersection of Two Arrays II LeetCode : 🔗2️⃣🧮
Given two integer arraysnums1andnums2, return an array of their intersection. Each element in the result must appear as many times as it shows in both arrays and you may return the result in any order. -
Binary Tree Inorder Traversal LeetCode : 🌳
Given therootof a binary tree, return the inorder traversal of its nodes' values. -
Add Binary LeetCode : 1️⃣➕0️⃣
Given two binary stringsaandb, return their sum as a binary string. -
Add to Array-Form of Integer LeetCode : 📊➕🔢
Given an integer arraynumrepresenting digits of an integer. Add another integerktonumand return the sum of both integers as an array of digits in left-to-right order. -
Minimum Distance Between BST Nodes LeetCode : 🌳🔍📏
Given therootof a Binary Search Tree (BST), return the minimum difference between the values of any two different nodes in the tree. -
Invert Binary Tree LeetCode : 🌳🔄💻
Given therootof a binary tree, invert the tree, and return its root. -
Binary Tree Zigzag Level Order Traversal LeetCode : 🌳⚡️🚶♂
Given therootof a binary tree, return the zigzag level order traversal of its nodes' values. (i.e., from left to right, then right to left for the next level and alternate between). -
Spiral Matrix LeetCode : 🔁🔢
Given anm x nmatrix, return all elements of thematrixin spiral order. -
Search Insert Position LeetCode : 🔍
⤵️ 📍
Given a sorted array of distinct integers and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order. The runtime complexity of the algorithm must beO(log n). -
Single Element in a Sorted Array LeetCode : 💡1️⃣🧐🔢
Given a sorted array of integers where all elements appear twice, except for one element that appears once, return the single element. The solution must have a time complexity ofO(log n)and a space complexity ofO(1). -
Single Number LeetCode : 🔢🤔1️⃣
Find the unique number in an array of integers where every element appears twice, except for one. The solution must have a linear runtime complexity and use only constant extra space. -
Capacity To Ship Packages Within D Days LeetCode : 🚢📦🕑
A conveyor belt has packages with weights that must be shipped within days. We load the ship each day with packages in the order given by weights, but can't exceed the maximum weight capacity of the ship. Find the least weight capacity needed to ship all packages within the given timeframe. -
Pascal's Triangle LeetCode : 🧑🔬🔢🔺
Given an integernumRows, return the first numRows of Pascal's triangle. In Pascal's triangle, each number is the sum of the two numbers directly above it. -
Valid Anagram LeetCode : 🔤🔁🔡✅
Given two stringssandt, returntrueiftis an anagram ofs, andfalseotherwise. 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. -
Valid Parentheses LeetCode : ✅ ( ) [ ] { }
Check if a string of brackets is valid by verifying that they are correctly opened and closed in the right order and that each opening bracket has a corresponding closing bracket. -
Basic Calculator II LeetCode : 🧮
Given a stringswhich represents an expression, evaluate this expression and return its value. The integer division should truncate toward zero. -
Edit Distance LeetCode : 🔤✂️🔡
Given two strings, return the minimum number of operations to convert one to the other using insert, delete, or replace operations on characters. -
String to Integer (atoi) LeetCode : 🧵➡️🔢
ThemyAtoifunction converts a string to a 32-bit signed integer by removing leading whitespace, reading an optional sign, extracting digits until the end of the input or a non-digit character, converting them to an integer, and clamping it if it's out of range. Return the integer as the final result. -
Number of Islands LeetCode : 🌊🏝️🌊
Given anm x n2D binary gridgridwhich represents a map of'1's (land) and'0's (water), return the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may assume all four edges of the grid are all surrounded by water. -
Number of Islands LeetCode : 🔁🔗📜
Given theheadof a singly linked list, returntrueif it is a palindrome orfalseotherwise. -
Convert Sorted Array to Binary Search Tree LeetCode : 🔢💻🌳
Given an integer arraynumswhere the elements are sorted in ascending order, convert it to a height-balanced binary search tree. -
Symmetric Tree LeetCode : 🌳👀🌳
Given therootof a binary tree, check whether it is a mirror of itself (i.e., symmetric around its center). -
Binary Tree Level Order Traversal LeetCode : 🌳🔢📊
Given therootof a binary tree, return the level order traversal of its nodes' values. (i.e., from left to right, level by level).