Skip to main content

Posts

InfyTQ Advantage Round Python Coding Questions & Answer 2022 - Special LIS

  InfyTQ  Advantage   Round Python Coding Questions & Answer 2022 Special LIS Problem statement-:   Given an array of N integers. Find the length of the longest increasing subsequence such that the difference between adjacent elements of the longest increasing subsequence is also increasing. Note: It’s not required that the sequence should have strictly increasing numbers and the differences are also not required to be strictly increasing. Ex: [1,2,3,4,5]. The longest increasing subsequence will be [1,2,4,5] but the difference array in this case is [1,2,1] which is not increasing. If we consider [1,2,4] or [1,2,5] then the numbers as well as the differences are in increasing order. Function Description: Complete the specialLIS function in the editor below. It has the following parameter(s): Parameters: Name Type Type size Integer size of array arr ...

InfyTQ Advantage Round Python Coding Questions & Answer 2022 - TOR

  InfyTQ  Advantage   Round Python Coding Questions & Answer 2022       TOR Problem Statement-: Lets define Ternary numbers to be the positive integer numbers that consist of digits 0,1,2 only. Let’s also define the operation TOR(x,y) to be the following operation on two Trenary numbers x and y (its output is z = TOR(x,y)). Go through the digits one by one . For each digit i, the digit i in the output will be z[i] = (x[i] + y[i]) % 3 You are given a positive integer n, and a long positive integer c, your job is to find two Ternary   numbers a,b (of length n) where c = TOR(a,b) and max(a,b) is as minimum as possible. After finding that pair output max(a,b). If there’s no such pair, output -1. Note 1: the given numbers won’t have any leading zeros. Note 2: a,b should be of length n without leading zeros. Note 3: since the answer can be very large, output it modulo 1000000007 (10^9 +7). Function Description: Complete...

InfyTQ Python Coding Questions & Answers 2022 - Find the homeless

  InfyTQ Python Coding Questions & Answers   2022 Find the homeless  Problem Statement -:   There are N Homeless people in the community and N houses in the community. It will be given in the array (people) , height of the person and in the array house capacity of the house is given. Government decided to give homes for people on the basis of following conditions: Priority is given for the people from left to right of the array Each person is allotted to a house if and only if the capacity of house is greater than or equal to persons height Nearby empty Houses are alloted to the person( starting from extreme left) You need to find the number of homeless people who have not allotted any home if the government follows the above conditions.So that government will have an idea for how many people they need to allot home for next time. Constraints: 1 <= N <= 10^3 1 <= people[i] <= 10^5 1 <= house[i] <= 10^5 Input Format...

InfyTQ Python Coding Questions & Answers 2022 - Airport authority

  InfyTQ Python Coding Questions & Answers   2022 Airport authority Problem Statement -: In an airport , the Airport  authority decides to charge some minimum amount to the passengers who are carrying luggage with them. They set a threshold weight value, say T, if the luggage exceeds the weight threshold you should pay double the base amount. If it is less than or equal to threshold then you have to pay $1.   Function Description: Complete the weightMachine function in the editor below. It has the following parameter(s): Parameters: Name Type Description N Integer number of luggage T Integer weight of each luggage weights[ ] Integer array threshold weight   Returns : The function must return an INTEGER denoting the required amount to be paid. Constraints: 1 <= N <= 10^5 1 <= weights[i] ...

InfyTQ Python Coding Questions & Answers 2022 - Amusement park

  InfyTQ Python Coding Questions & Answers   2022 Amusement park Problem Statement –   Aashay loves to go to WONDERLA , an amusement park. They are offering students who can code well with some discount. Our task is to reduce the cost of the ticket as low as possible. The cost of tickets can be removed by removing the digits from the price given. They will give some k turns to remove the digits from the price of the ticket. Your task is to help Aashay in coding a program that can help him to reduce the cost of a ticket by removing the digits from its price and getting the maximum possible discount. Note –  You cannot make the cost of a ticket zero. For eg -: If the cost of a ticket is 100, and you have 2 turns to reduce the price, the final price will be 1 and not zero. Constraints: 1 <= number of tickets <= 10^5 1 <= K <= number of tickets Input Format for Custom Testing: The first line contains a string,Tickets, denoting the give...

InfyTQ Python Coding Questions & Answers 2022 - Parallel Columbus

  InfyTQ Python Coding Questions & Answers   2022 Parallel Columbus Problem Statement –  Nobel Prize-winning Austrian-Irish physicist Erwin Schrödinger developed a machine and brought as many Christopher Columbus from as many parallel universes he could. Actually he was quite amused by the fact that Columbus tried to find India and got America. He planned to dig it further. Though totally for research purposes, he made a grid of size n X m, and planted some people of America in a position (x,y) [in 1 based indexing of the grid], and then planted you with some of your friends in the (n,m) position of the grid. Now he gathered all the Columbus in 1,1 positions and started a race. Given the values for n, m, x, y, you have to tell how many different Columbus(s) together will explore you as India for the first time. Remember, the Columbus who will reach to the people of America, will be thinking that as India and hence wont come further. Function Description:...