Skip to main content

378 docs tagged with "Java"

View all tags

Add Strings

This is a solution to the Add Strings problem on LeetCode.

Anagram of String

This document covers methods to check if two strings are anagrams of each other in various programming languages.

Angle between Hour and Minute Hand

This document covers methods to calculate the angle between the hour and minute hands of a clock at a given time in various programming languages.

Balanced Array

This document covers methods to check if an array is balanced in various programming languages.

BFS of Graph

This document provides solutions to the problem of performing a Breadth First Search (BFS) traversal of a directed graph in various programming languages.

Binary Array Sorting

This document provides solutions for sorting a binary array, where elements are either 0 or 1.

Binary Search

This document provides solutions to the problem of performing Binary Search in a sorted array.

Binary String

This document provides solution on how to find substrings of a binary string in various programming languages.

Binary Trees With Factors

This document provides a solution to the Binary Trees With Factors problem, where we need to count the number of binary trees that can be formed with a given array of integers such that each node's value is the product of its children's values.

Binary Trees With Factors

This document provides a solution to the Binary Trees With Factors problem, where we need to count the number of binary trees that can be formed with a given array of integers such that each node's value is the product of its children's values.

Binary Watch

This is a solution to the Binary Watch problem on LeetCode.

Bit Difference

This document explains how to convert A to B using bit manipulation.

Brick-Wall

This is a solution to the. Brick-Wall problem on LeetCode

Candy

This is a solution to the Candy problem on LeetCode.

Card Flipping Game

This document provides a solution to the Card Flipping Game problem, where we need to find the smallest number that is on the front of a card and not on the back of any card.

Check Equal Arrays

This document provides solutions to whether two arrays are equal or not.

Check for Subsequence

This document covers methods to check if one string is a subsequence of another string in various programming languages.

Check if Point is Reachable

This document provides a solution where we need to reach the point (targetX, targetY) using a finite number of steps.

Climbing Stairs

This document explores different approaches to solving the climbing stairs problem, including recursion, memoization, tabulation, and space optimization.

Closest Number

This document covers methods to find the closest number to a given target in an array in various programming languages.

Corporate Flight Bookings

Solve the problem of calculating the total number of seats reserved for each flight using the booking intervals and prefix sum technique.

Count Odd Even

This document covers methods to count the number of odd and even integers in an array.

Count Squares

This document provides solutions for calculating perfect squares.

Counting Bits

This is a solution to the Counting Bits problem on LeetCode.

Delete Alternate Nodes

This document covers methods to delete alternate nodes from a linked list in various programming languages.

Delete Middle of Linked List

This document provides solutions to the problem of deleting the middle node from a singly linked list in various programming languages.

Delete Node in a Linked List

This document provides a solution to the Delete Node in a Linked List problem, where we need to delete a given node from a singly linked list.

Delete Nodes And Return Forest

Solve the problem of deleting nodes from a binary tree and returning the forest of remaining trees using depth-first search.

Delete without Head Pointer

This document provides solutions to the problem of deleting a node from a singly linked list without having a reference to the head pointer in various programming languages.

Design an ATM Machine

This document provides solutions to this problem implemented in C++, Java, and Python.

Domino and Tromino Tiling

Solve the problem of finding the number of ways to tile a 2 x n board using 2 x 1 dominos and tromino shapes.

Elements in the Range

This document covers methods to find elements within a specified range in an array in various programming languages.

Exceptionally Odd

This document covers methods to find the element that occurs an odd number of times in an array in various programming languages.

Factorial

This document provides solutions to finding the factorial of a number.

Faulty Keyboard

This is a solution to the Faulty Keyboard problem on LeetCode.

Fenwick Tree Solution

This document provides solutions to a problem using the Fenwick Tree (Binary Indexed Tree) data structure, implemented in C++, Java, and Python.

Find n/k-th Node in Linked List

This document covers methods to find the n/k-th node in a linked list, where n is the length of the list and k is a given integer, in various programming languages.

Find Position of Set Bit

This document covers methods to find the position of the set bit in a number in various programming languages.

Find the Closest Palindrome

This document provides a solution where we need to find the nearest palindrome to a given number n, the idea is to generate potential palindromic candidates close to n and then determine which one is closest in terms of absolute difference.

Find the Fine

This document covers methods to calculate total fines based from the cars in various programming languages.

Find the Grid of Region Average

Calculate the m x n grid result, where result[i][j] is the average intensity of the regions to which image[i][j] belongs, rounded down to the nearest integer.

Find Triplet with Zero Sum

This document explores different approaches to solving the problem of finding a triplet in an array that sums up to zero, including solutions in JavaScript, TypeScript, Python, Java, and C++.

First and Last Occurrences of X

This document covers methods to find the first and last occurrences of a specified element X in an array in various programming languages.

Game with Numbers

This document provides solutions for forming the array by xoring the consecutive elements in various programming languages.

GCD of Array

This document covers methods to calculate the Greatest Common Divisor (GCD) of an array of integers in various programming languages.

Gray to Binary Equivalent

This document explores different approaches to solving the Gray to Binary Equivalent problem, including brute force, bit manipulation, and optimization techniques, in various programming languages.

Greater on Right Side

This document covers methods to replace every element with the greatest element in various programming languages.

Happy Number

This document provides a solution for Happy Number problem on LeetCode.

House Robber II

This document provides a solution to the House Robber II problem, where houses are arranged in a circle.

Identical Linked Lists

This document provides solutions for checking whether two linked lists are identical or not.

Implement Queue using Stacks

This document provides an implementation of a queue using stacks, supporting push, pop, peek, and empty operations.

Implement strstr

This document provides solutions to check if a string is a substring of another.

Implement Trie

This document provides a solution to the Implementation of Trie.

Implement Two Stacks in an Array

This document provides solutions to the problem of implementing two stacks in a single array using various programming languages.

Ishaan Loves Chocolates

This document covers methods for determining the tastiness level of the square which his sister gets in various programming languages.

Isomorphic Strings

This document provides solutions for determining if two strings are isomorphic.

Last Index of One

This document covers methods to find the last index of '1' various programming languages.

LCM and GCD

This document provides solutions for finding the Least Common Multiple (LCM) and Greatest Common Divisor (GCD) of integers.

Leap Year

This document covers methods to determine if a given year is a leap year or not in various programming languages.

Lemonade Change

This document explores different approaches to solving the lemonade change problem, including an easy C++ solution with a greedy algorithm approach.

Linked List Components

This document provides a solution to the Linked List Components problem, where we need to count the number of connected components in a linked list.

Linked List Length Even or Odd

This document covers methods to determine if the length of a linked list is even or odd in various programming languages.

Majority Element II

This document provides a solution to the Majority Element II problem, where we need to find all elements that appear more than ⌊ n/3 βŒ‹ times.

Matchsticks Game

This is a solution to the problem of determining the number of matchsticks the first player should pick to guarantee a win in the matchsticks game.

Max Min

This document covers methods to find the maximum and minimum elements in an array using various programming languages.

Maximal Square

This document provides a solution where we find the largest square containing only 1's and return its area.

Maximum Days Without Darkness

This document covers methods to find the maximum number of days the room remains illuminated using candles that reduce by 1 unit each day, given an array representing the sizes of the candles.

Maximum Money

This document covers methods to calculate the maximum amount of money that can be collected from a sequence of houses where every house has some amount of money in various programming languages.

Maximum Total Reward Using Operations

This document provides solutions for finding the maximum total reward using dynamic programming and bit manipulation, implemented in C++, Java, and Python.

Median Finder

This document provides a solution to the Median Finder problem, where you need to efficiently find the median of a stream of numbers.

Middle of Three

This document covers methods to find the middle of three given numbers in various programming languages.

Min falling path sum in a Triangle

Given a triangular type matrix we need to return the minimum sum for reaching the bottom from the top . in each step we can either move down or diagonally right

Min falling path sum in a Triangle

Given a triangular type matrix we need to return the minimum sum for reaching the bottom from the top . in each step we can either move down or diagonally right

Min Max Game

This document provides solutions to this problem implemented in C++, Java, and Python.

Minimize Manhattan Distances

This document provides solutions for Minimize Manhattan Distances using dynamic implemented in C++, Java, and Python.

Minimum Depth of Binary Tree

Find the minimum depth of a binary tree, which is the number of nodes along the shortest path from the root node down to the nearest leaf node.

Minimum element in BST

This document provides solutions to finding the minimum element in a binary search tree.

Minimum Indexed Character

This document explores different approaches to solving the problem of finding the minimum index of a character in a string that is also present in another string, including solutions in JavaScript, TypeScript, Python, Java, and C++.

Missing Number

This document covers methods to find the missing number in an array in various programming languages.

Most Common Word

This document provides a solution to the Most Common Word problem, where we need to find the most frequent word in a paragraph that is not in a list of banned words.

Multiply Left and Right Array Sum

This document covers methods to calculate the product of the left and right array sums for a given array in various programming languages.

Number is Sparse or Not

This document covers methods to determine if a number is sparse or not in various programming languages.

Number of Digit One

This document provides a solution where we count the total number of digit $1$ appearing in all non-negative integers less than or equal to n.

Odd Even Linked List

This document provides a solution to group all the nodes with odd indices together followed by the nodes with even indices given the head of a singly linked list.

Pancake Sorting

This is a solution to the Pancake Sorting problem on LeetCode.

Patching Array

This document provides solutions for the Patching Array problem.

Paths to Reach Origin

This document explores finding the number of paths to reach the origin (0, 0) on a grid.

Pattern 1

This document covers methods to print square pattern in various programming languages.

Pattern 10

This document covers methods to print a pattern in various programming languages.

Pattern 5

This document covers methods to printinverted pyramid in various programming languages.

Pattern 6

This document covers methods to print triangle number in various programming languages.

Peak Element

This document provides solutions to the problem of finding peak element in an array.

Perfect Number

This document provides solutions for the Perfect Number problem.

Power Of 2

This document provides solutions to the problem of checking whether a non-negative number is a power of 2.

Power of Four

This is a solution to the Power of Four problem on LeetCode.

Preorder Traversal

This document provides solutions to preorder traversal of a binary tree.

Prime Number

This document provides solutions to checking whether a number is prime or not.

Product of Array Elements

This document covers methods to calculate the product of all elements in an array in various programming languages.

Reducing Dishes

This document provides a solution to the Reducing Dishes problem, where we need to maximize the sum of the satisfaction of dishes.

Relative Ranks

This document provides solutions for the Relative Ranks problem.

Remove Character

This document covers methods to remove a characters from the first string that are present in the second string in various programming languages.

Remove Consecutive Characters

This document covers methods to remove consecutive duplicate characters from a string in various programming languages.

Repeated Character

This document covers methods to find the first repeated character in a string in various programming languages.

Replace All 0's with 5

This document covers methods to replace all occurrences of the digit 0 with the digit 5 in a given number in various programming languages.

Replace All 0's with 5

This document covers methods to replace all occurrences of 0 with 5 in a given number in various programming languages.

Replace Words

This is a solution to the Replace Words problem on LeetCode.

Reverse a Doubly Linked List

This document explores different approaches to reversing a doubly linked list in-place, including solutions in Python, Java, C++, JavaScript, and TypeScript.

Reverse a Linked List

This document explores different approaches to reversing a linked list, including solutions in Python, Java, C++, JavaScript, and TypeScript.

Reverse a String

This document provides solutions to the problem of reversing a string.

Reverse LinkedList

This document provides solutions for determining the Reverse Linkedlist.

Rotate Array

This is a solution to the Rotate Array problem on LeetCode.

Rotating an Array

This document provides solutions for rotating an array to the left or right by a specified number of positions.

Search a Node in BST

This document covers methods to search for a node in a Binary Search Tree (BST) in various programming languages.

Searching a number

This document provides solutions to finding the position of an element in the array.

Set kth Bit

This document covers methods to set the kth bit of a number to 1 in various programming languages.

Set Mismatch

This is a solution to the Set Mismatch problem on LeetCode.

Shortest Palindrome

This document provides a solution to finding the shortest palindrome by adding characters in front of the given string.

Single Number

This is a solution to the Single Number problem on LeetCode.

Single Number III

Given an integer array `nums`, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements that appear only once. You can return the answer in any order.

Size of Binary Tree

This document covers methods to calculate the size (number of nodes) of a binary tree in various programming languages.

Sorted Matrix

This document covers methods to sort elements of a matrix in non-decreasing order in various programming languages.

Special Array II

This document provides solutions to this problem implemented in C++, Java, and Python.

Spiral Matrix

This document provides a solution to the Spiral Matrix problem, where the goal is to traverse a matrix in spiral order.

Split Array With Same Average

This document provides a solution where we split an array into two non-empty subsets such that both subsets have the same average.

Start Coding

This document provides solutions to print Hello World in various programming languages

Sum of First n Terms

This document covers methods to calculate the sum of the first n terms of a series in various programming languages.

Sum of Numbers in String

This document covers methods to calculate the sum of all numbers embedded in a string in various programming languages.

Total Appeal of a String

This document provides a solution to the Total Appeal of a String problem, where we need to calculate the total appeal of all substrings of a given string.

Ugly Number

This document provides a solution to the Ugly Number problem, where we need to determine if a number is an ugly number.

Ugly Number II

This document provides a solution to the Ugly Number II problem, where we need to find the nth ugly number.

Uncommon Characters

This document covers methods to find uncommon characters between two strings in various programming languages.

Union Of Two Arrays

This document provides solutions to the problem of finding the number of elements in the union between two arrays.

Unique Paths III

Find the number of unique paths from the starting square to the ending square in a grid, walking over every non-obstacle square exactly once.

Valid Anagram

This is a solution to the Valid Anagram problem on LeetCode.

Water-Bottles-II

This document provides solutions for Water-bottles-II solution of leetcode questions

Ways To Tile A Floor

This document covers methods to calculate the number of ways to tile a floor of given dimensions using tiles of given sizes in various programming languages.

Word Search II

This document provides a solution to the Word Search II problem, where we need to return all words on the board, given an mXn board of characters and a list of strings words.