Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
18 views5 pages

More Questions

The document outlines a series of programming problems categorized by difficulty levels: Easy, Medium, and Hard, with specific LeetCode references for each problem. It includes additional problems related to counting subarrays, string edit distance, and optimal time calculation, among others. Sample input and output formats are provided for some problems, along with constraints and examples.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views5 pages

More Questions

The document outlines a series of programming problems categorized by difficulty levels: Easy, Medium, and Hard, with specific LeetCode references for each problem. It includes additional problems related to counting subarrays, string edit distance, and optimal time calculation, among others. Sample input and output formats are provided for some problems, along with constraints and examples.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

More Questions:

Easy Level

Good warm-up and perfect for quick solutions under 10-15 minutes each.

 Two Sum (LeetCode #1)


→ Find indices of two numbers adding up to a target.

 Move Zeroes (LeetCode #283)


→ Shift all zeroes to end while maintaining order.

 Valid Parentheses (LeetCode #20)


→ Check if brackets are balanced.

 Count Frequency of Characters in String


→ Simple hash map usage.

 Maximum Subarray (LeetCode #53)


→ Kadane’s algorithm.

Medium Level

The sweet spot for HackWithInfy first round. Spend ~30-45 minutes per problem.

 Longest Substring Without Repeating Characters (LeetCode #3)


→ Sliding window technique.

 Subarray Sum Equals K (LeetCode #560)


→ Prefix sum + HashMap.

 Minimum Size Subarray Sum (LeetCode #209)


→ Sliding window.

 Group Anagrams (LeetCode #49)


→ Hashing sorted strings.

 Rotate Image (LeetCode #48)


→ Matrix manipulation.

 Find All Duplicates in an Array (LeetCode #442)


→ In-place marking.

 Coin Change (LeetCode #322)


→ Classic DP problem.

 Minimum Window Substring (LeetCode #76)


→ Advanced sliding window.

 Implement Trie (Prefix Tree) (LeetCode #208)

 Detect Cycle in Linked List (LeetCode #141)


 Find the Town Judge (LeetCode #997)
→ Graph degree problem.

Hard Level

Great prep for HackWithInfy Grand Finale or to ensure a top rank.

 Longest Increasing Subsequence (LeetCode #300)


→ DP with O(N log N) solution.

 Word Search II (LeetCode #212)


→ Backtracking + Trie.

 Number of Islands II (LeetCode #305)


→ Union-Find.

 Sliding Window Maximum (LeetCode #239)


→ Monotonic Queue.

 Palindrome Pairs (LeetCode #336)


→ String hashing or Trie.

 Minimum Cost to Connect All Points (LeetCode #1584)


→ Kruskal or Prim.

 Shortest Path in Binary Matrix (LeetCode #1091)

 Partition Equal Subset Sum (LeetCode #416)


→ DP subset sum.

Problem 1: Count Alternating Subarrays

Given an array of 0s and 1s, count the number of subarrays where no two adjacent elements are
the same.

Problem 2: String Edit Distance

Given two strings, find the minimum operations (insert, delete, replace) to convert one string
into another.

Problem 3: Optimal Time Calculation

A server processes tasks arriving at di erent times. Each task takes a fixed time to execute. Find
the total time taken to finish all tasks considering a cooldown period.
Problem 4: Product of Array Except Self

Given nums, return an array result where result[i] = product of all nums except nums[i], without
using division.

Problem 5: Minimum Jumps

You’re given an array where each element represents max jump length. Find minimum jumps to
reach end.

Focus on:

 Time and space complexity

 Edge cases

 Writing clean, readable code

Question 5:

There are three piles of stones. The first pile contains a stones, the second pile contains b
stones and the third pile contains c stones. You must choose one of the piles and split the
stones from it to the other two piles; specifically, if the chosen pile initially contained s stones,
you should choose an integer k (0≤k≤s), move k stones from the chosen pile onto one of the
remaining two piles and s−k stones onto the other remaining pile. Determine if it is possible for
the two remaining piles (in any order) to contain x stones and y stones respectively after
performing this action.

INPUT FORMAT :

 The first line of the input contains a single integer T denoting the number of test cases.
The description of T test cases follows.

 The first and only line of each test case contains five space-separated integers

a,b,c, x and y.

OUTPUT FORMAT :

For each test case, print a single line containing the string “YES” if it is possible to obtain piles of
the given sizes or “NO” if it is impossible.

CONSTRAINTS :

 1 <= T <= 100

 1 <= a,b,c,x,y <= 10^9

SAMPLE INPUT :

12324
32565

24262

6 5 2 12 1

SAMPLE OUTPUT :

YES

NO

YES

NO

Test case 1: You can take the two stones on the second pile, put one of them on the first pile
and the other one on the third pile.

Test case 2: You do not have enough stones.

Test case 3: You can choose the first pile and put all stones from it on the second pile.

Question 6:

Altaf has recently learned about number bases and is becoming fascinated.

Altaf learned that for bases greater than ten, new digit symbols need to be introduced, and that
the convention is to use the first few letters of the English alphabet. For example, in base 16, the
digits are 0123456789ABCDEF. Altaf thought that this is unsustainable; the English alphabet
only has 26 letters, so this scheme can only work up to base 36. But this is no problem for Altaf,
because Altaf is very creative and can just invent new digit symbols when she needs them. (Altaf
is very creative.)

Altaf also noticed that in base two, all positive integers start with the digit 1! However, this is the
only base where this is true. So naturally, Altaf wonders: Given some integer N, how many bases
b are there such that the base-b representation of N starts with a 1?

INPUT FORMAT :

The first line of the input contains an integer T denoting the number of test cases. The
description of T test cases follows.

Each test case consists of one line containing a single integer N (in base ten).

OUTPUT FORMAT :

For each test case, output a single line containing the number of bases b, or INFINITY if there
are an infinite number of them.

CONSTRAINTS :
 1 <= T <= 10^5

 0 <= N < 10^12

SAMPLE INPUT :

11

24

SAMPLE OUTPUT :

14

You might also like