# Tag: list

## Find the start and end index of unsorted subarray….FcukTheCode

Find the start and end index of unsorted subarray such that sorting this subarray can sort all the array. INPUT_1:Array:  2  6  4  8  10 …

## Sort a sub-array which makes whole array sorted…FTC

Given an integer array nums, you need to find one continuous subarray that if you only sort this subarray in ascending order, then the whole…

## Check if reversing subarray makes the array sorted.

Given an array of distinct n integers. The task is to check whether reversing one sub-array make the array sorted or not. If the array…

## Smallest Difference Triplet…FTC

Three arrays of same size are given. Find a triplet such that maximum – minimum in that triplet is minimum of all the triplets. A…

## Rearrange characters such that no two adjacent are same ….Python[FTC]

Rearrange characters in a string such that no two adjacent are same.Given a string str, rearrange the characters of s so that any two adjacent…

## Matrix Cells in Distance Order….FTC

We are given a matrix with R rows and C columns has cells with integer coordinates (rCenter, cCenter), where 0 <= r < R and…

## Given an array of strings, group anagrams together….FcukTheCode

Given an array of words, Group all anagrams together. Anagrams : a word, phrase, or name formed by rearranging the letters of another, such as spar, formed…

## Given an array of strings, print anagrams….FcukTheCode

Given an array of words, print all anagrams together. Anagrams : a word, phrase, or name formed by rearranging the letters of another, such as spar,…

## Given an array of meeting time intervals consisting of start and end times [[s1,e1]…Fcukthecode

Given an array of meeting time intervals consisting of start and end times [[s1,e1],[s2,e2],…] (si < ei), determine if a person could attend all meetings.…

## [C program]Find the number of pairs if positive intgers(X,Y)…FcukTheCode

Tina’s trainer have given her two positive integers U and V. Now her task is to find the number of pairs if positive intgers(X,Y)such that…

## Find Largest Divisble Subset…-FcukTheCode

Given a set of distinct positive integers, find the largest subset such that every pair (Si, Sj) of elements in this subset satisfies:Si % Sj=…

## Given an integer array nums…sum,update[FTC]

Multiple Queries using array numsGiven an integer array nums, handle multiple queries of the following types:Update the value of an element in nums.Calculate the sum…

## All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T…[FTC]

All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: “ACGAATTCCG”. When studying DNA, it is sometimes…

## Relative Ranks…[FTC]Python…Athelete Scores

You are given an integer array score of size n, where score[i] is the score of the ith athlete in a competition. All the scores…

## [FTC]Given an unsorted array nums, reorder it in-place such that nums[0] <= nums[1] >= nums[2] <= nums[3]….[FTC]

Given an unsorted array nums, reorder it in-place such that nums[0] <= nums[1] >= nums[2] <= nums[3]…. Input_1:Array_nums : 20 10 8 6 4 2Output:[2, 10, 6, 8, 4,…

## Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive)…FTC

Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist. Assume that there is…

## Maximum Result of ai XOR aj …[FTC]Python

Given a non-empty array of numbers, a0, a1, a2 ….. where 0 ≤ ai < 2^31. Find the maximum result of ai XOR aj, where 0 ≤ i, j < n. Could you…

## Find the majority element appearing more than n/2 times

Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.You may…

## Return an array of the squares of each number.

Given an array of integers A sorted in non-decreasing order, return an array of the squares of each number, also in sorted non-decreasing order. Input_1:Enter a list of arrays…

## Find the empty packets(0) of chocolate and push it to the end of the conveyor belt(array).

A chocolate factory is packing chocolates into the packets. The chocolate packets here represent an array arrt of N number of integer values. The task…