# Longest Consecutive Sequence

Given an unsorted array, one has to return the length of the array subset with consecutive elements(Full Question)

• if the element+1 number does exist we keep increasing a…

# Maximum Product Subarray

Given an array that contains n integers that could be positive, negative, or zero, return the product returned by the subarray with the maximum product (Full Question)

# Chocolate Distribution Problem

Given an array of positive integers of size n, where each value represents the number of chocolates in a packet. Each packet can have a variable number of chocolates. …

# Pairs in array with given sum

Given an array of size n, return the array with the index of the pair that would give the sum k. …

# Minimize difference between array values

You are given an integer array nums and an integer k. The score of nums is the difference between the maximum and minimum elements in nums. Return the minimum score of nums after changing the values at each index. (Question 1, Question 2)

# Minimum number of jumps to reach the end of the array

Given an array of non-negative integers nums, you are initially positioned at the first index of the array. Each element in the array represents your maximum jump length at that position. Your goal is to reach the last index in the minimum number of jumps. (Full Question)

# Move Negative Elements to the end

Given an array of size n with negative and positive elements, the task is to place all negative elements to the end keeping all positive elements in the beginning(Full Question)

• We come across four scenarios while we…

# Reverse Array in groups

Given an array of positive integers of size n. Reverse every sub-array group of size k(Full Question)

• The start index which starts from 0 ans is incremented by k values on each iteration; it goes with values 0,k,2k...till n-1
• The end index starts with start+k-1 index till n-1
• This way the values are reversed in a window of k alone
`void reverseInGroups(ArrayList<Integer> arr, int n, int k) {    for(int i=0;i<n;i+=k){        int start=i;        int end=Math.min(start+k-1,n-1);        // we handle cases where i+k goes out of bounds here        int temp=0;        while(start<end){            temp=arr.get(start);            arr.set(start,arr.get(end));            arr.set(end,temp);            start++;            end--;        }        }}`

# Reverse Only Letters

Given a string s, reverse the string according to the following rules:

All the characters that are not English letters remain in the same position.

All the English letters (lowercase or uppercase) should be reversed.

Return s after reversing it.

# First Unique Character in a String

Given a string s, find the first non-repeating character in it and return its index. If it does not exist, return -1(Full Question)

• Once the string is iterated…

## Chaitra Rai

Intimidated developer trying to find her way into technology dominant world