Home
Gaurav's GitHub Page
Cancel

Finish Maximum Jobs

Problem Description There are N jobs to be done, but you can do only one job at a time. Given an array A denoting the start time of the jobs and an array B denoting the finish time of the jobs. Yo...

Kth Largest Element in a Stream

Problem Description Design a class to find the kth largest element in a stream. Note that it is the kth largest element in the sorted order, not the kth distinct element. Implement KthLargest cla...

Find Median from Data Stream

Problem Description The median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value and the median is the mean of the two middle values. Fo...

Last Stone Weight

Problem Description You are given an array of integers stones where stones[i] is the weight of the ith stone. We are playing a game with the stones. On each turn, we choose the heaviest two stone...

Kth Largest Element in an Array

This question is part of NeetCode150 series. Problem Description Given an integer array nums and an integer k, return the kth largest element in the array. Note that it is the kth largest element...

Reverse Bits

This question is part of NeetCode150 series. Problem Description Reverse bits of a given 32 bits unsigned integer. leetcode Solution APPROACH 1 public class Solution { public int reve...

Zigzag Traversal

Problem Description Given an m x n matrix mat, return an array of all the elements of the array in a zigzag/diagonal order. Input: mat = [[1,2,3],[4,5,6],[7,8,9]] Output: [1,2,4,7,5,3,6,8,9] lee...

Maximum AND Value

Problem Description Given an array arr[] of N positive elements. The task is to find the Maximum AND Value generated by any pair(arri, arrj) from the array such that i != j. Note: AND is bitwise ‘...

Missing Number

This question is part of NeetCode150 series. Problem Description Given an array nums containing n distinct numbers in the range [0, n], return the only number in the range that is missing from th...

Sum of XOR of all pairs

Problem Description Given an array of N integers, find the sum of xor of all pairs of numbers in the array. geeksforgeeks Solution class Solution{ // Function for finding maximum and val...