# Array

## for … in and for … of loop in JavaScript

We all know about the loop. A loop is a fundamental concept in any programming language. Generally, we use a loop for repetitive tasks or go through iterable objects. Remember everything in JavaScript is an Object. Let’s see a traditional for loop in JavaScript. We will print all array elements using the following loop. Intro […]

## Kth Smallest Element in a BST | LeetCode 230 | Python | Solution

LeetCode 230 I hope you already know about Binary Search Tree. In BST, each node is greater than its left subtree and smaller than its right subtree. If we print all the nodes of a BST using an inorder traversal algorithm, we will get the sorted value in ascending order. Inorder traversal follows the rule:

## Binary Tree Level Order Traversal | LeetCode 102 | Python | Solution

LeetCode 102 This problem just simply the implementation of the level order traversal algorithm. If you don’t know about level order traversal yet, you can check my blog on this topic. As we know, using level order traversal, we traverse through the tree level by level. But in this problem, we have to separate values

## Maximum Number of Words Found in Sentences | LeetCode 2114 | LeetCode | Python | Solution

LeetCode 2124 This one is one of the easy problems on LeetCode. To solve this problem, mainly you have to know how to split a sentence based on spaces and count array elements. If you know the basics of Python, this will not be a big deal for you. You can solve this problem. I

## Group Anagrams | LeetCode 49 | Python | Solution

LeetCode 49 If you know how to valid anagram, this one will be easier for you to solve. You can check this to know about it (Valid Anagram). I assume that you already know how to valid anagram. So, to solve this problem, we do the same thing. But this time, we have to group

## Kth Largest Element in an Array | LeetCode 215 | Python | Solution

LeetCode 215 From an integer array, we have to find the kth largest element. I assume that you already know about the sorting algorithms. We all know how to access an element from an array. If we sort it in descending order, the kth position will be k-1. We all know that an array index

## Move Zeroes | LeetCode 283 | Python | Solution

Click here to see the problem details on LeetCode. Problem Overview This problem’s difficulty level is easy. The problem description is straightforward. In an integer array, we have to move all 0’s to the end of it. And maintain the relative order of other elements. Suppose we have an array [2, 0, 1] as an

## Majority Element | LeetCode 169 | Python | Solution

Click here to see the problem details on LeetCode. Solution Simple problem. We need to find out the majority element from an integer array.Suppose we have an array: [5, 5, 1, 2, 5, 1, 3, 5, 5]. In this array, the number 5 appears five times. And it’s the majority element of the array. The

## Find First and Last Position of Element in Sorted Array | LeetCode 34 | Python | Solution

Click here to see the problem details on LeetCode. Problem Overview We will be given an integer array (sorted in no-decreasing order) and an integer. We have to find the position of the given integer from the Array. But there is a trick. That is, we have to find the first and last position of

## Shuffle String | LeetCode 1528 | Python | Solution

Click here to see the problem details. Problem Overview This problem is quite simple. We will be given a string (s) and an array (indices) that is the same length as the string. All of the integers of the array are unique, and of course, all the integers will be less or equal to the