/Elab-second-sem

Solved solutions for SRM CARE- ELab for subject Programming for Problem Solving

Primary LanguageC

Elab-second-sem

Solved solutions for SRM CARE- ELab for subject Programming for Problem Solving

//Below this are the questions for your reference. //Only for level 1

1 Arif came from a very low income family. However, his father Irfan, sent him abroad for the purpose of studying. Arif also concentrated well in his learning keeping in mind his father's poverty. Arif was excellent in mathematics. One day Arif had a computer class and his computer teacher asked him to create a programming logic for the mathematics problem of multiplying two numbers of type float.

2 Selvan was playing with the a object of random size for stress relief. Selvan knows that the length, Width, and Height of the object. But he would like to know the surface area of the object he is playing with. Can you help him in finding it? Functional Description: Functional Description: Surface area of the Object = 2 x [width x length + length x height + height x width]

3 On one beautiful Sunday Selvan went to Aaron's house for exam preparation. They have decided to study Mathematics subject because they have exams by coming Monday, Aaron is a master in Mathematics but Selvan is not so good in Mathematics so James trained with Selvan for getting a high score in the exam. After teaching some problems to Selvan.Aaron have given some tasks to Selvan to solve. The problem is to convert input float into a double. Can you help Selvan in finding the solution ?

4 Binita is playing a chess. The game will be played on a rectangular grid consisting of N rows and M columns. Initially all the cells of the grid are uncolored. Binita's initial score is zero. At each turn, he chooses some cell that is yet not colored, and colors that cell. The score obtained in this step will be number of neighboring colored cells of the cell that Binita colored in this step. Two cells are neighbors of each other if they share a side between them. The game will end when all the cells are colored. Finally, total score obtained at the end of the game will sum of score obtained in each turn. Binita wants to know what maximum score he can get? Can you please help him in finding this out?

5 Professor JD has lots of options. Bottles containing all types of potions are stacked on shelves which cover the entire wall from floor to ceiling. Professor JD has broken his bones several times while climbing the top shelf for retrieving a potion. He decided to get a ladder for him. But he has no time to visit Charu. So he instructed Bargav to make a ladder for him. Professor JD specifically wants a step ladder that looks like an inverted 'V' from a side view. Professor just mentioned two things before vanishing- B-separation between left side (LS) and right side (RS) on the ground LS - the length of left side What should be the length of RS? At one extreme LS can be vertical and at other RS can be vertical. Bargav is angry and confused. Can you help him find the minimum and maximum length of RS. 6 Phoenix mall in the capital city of Washington and it is rectangular in shape when it is seen on the map with the size n x m meters. On the occasion of the jubilee anniversary, a decision was taken to pave the Square with square marbles stones. Each stone is of the size nxn. Can you what is the least number of stones needed to pave the Square? It's allowed to cover the surface larger than the Mall Square, but the Square has to be covered. It's not allowed to break the stones. The sides of stones should be side by side parallel) to the sides of the Square. 7 Binita was travelling from Chennai to Delhi in Rajdhani Express. The train have arrived at the destination later than the estimated time. So, Binita wants to know the total number of hours and minutes the train was delayed. Can you help Binita in finding the exact hour and time Rajdhani Express was delay on the day of Binita's journey?

8

Nancy bought apples in a fruit shop. The shop keeper specified the the bill amount. Nancy also given some amount to the shop keeper for paying the bill. But she likes to know the quotient and remainder after dividing the amount given by her by the bill amount specified by shop keeper. Can you help nancy in finding it?

9

Rathik organized technical round interview in Macrosoft for the set of computer science candidates. The problem is to perform addition, subtraction, multiplication, and division of given two numbers. Rathik have given the deadline of only 5 minutes to complete the problem. Can you Help the candidates to complete the problem within the specified time limit ?

10

Tina's brother gave her a friendly task of calculating the number of squares in a board that has n*n squares of dimensions 1cm *1 cm each. Help her to find the number of total squares including all small and big ones.

11 Johit has two rectangles. The lengths of the vertical sides of the first rectangle are 'A' and the lengths of the horizontal sides of the first rectangle are 'B' The lengths of the vertical sides of the second rectangle are 'C' and the lengths of the horizontal sides of the second rectangle are 'D' Johit would like to know the area of the rectangel with the larger area. Can you help him finding it?

12 Yasir a techie working in a military camp was checking the landmine as per their sequence of numbers. Whatever the number the major gives yasir has to : Check if (number < 0), then need to print as negative. Check if(number > 0), then need to print as positive.

13 Tamilselvan wanted to help the needy people on his birthday. So he started that from the temple where beggars are high in numbers. He checked his wallet to give them the money evenly. But only after taking out the wallet noticed he dosen't have enough money. But he has the amount in his UPI App. One person nearby noticed it and said he will provide him the minimum number of currency required if he transfers the amount to him through UPI App. Tamilselvan thought it would be better if there is any logic available to verify the correctness of the amount he gets from that person Note: Tamilselvan needs the amount only in the form of Rs.50, 20, 10, 5, 2, 1 Can you help Tamilselvan in doing that?

14 Problem Description: There are two monkeys on an x-axis ready to jump in the positive direction (ie, toward positive infinity). The first monkey starts at location xl and moves at a rate of vl meters per jump. The second monkey starts at location x2 and moves at a rate of v2 meters per jump. Given the starting locations and movement rates for each monkey, can you determine if they'll ever land at the same location at the same time?

15 Selvan is working as a QC in a reputed Multinational Conglmerate. His task is to check if the given Keyboard has a valid alphabets. But since many Keyboards are need to be verified, he is finding is difficult to finish the task. Can you automate the checking process and reduce his work load

16 Anegan is a member of a programming competition site, Awesome Coder. Each member of the Awesome Coder is assigned two values: Inner Rating and Displayed Rating. The Displayed Rating of a member is equal to their Inner Rating if the member has participated in 10 or more contests. Otherwise, the Displayed Rating will be their Inner Rating minus 100 x (10-K) when the member has participated in K contests. Anegan has participated in N contests, and his Displayed Rating is R. Find his Inner Rating.

17 The Election Commission of India distributed the voter ID to all eligible citizens. But Amira didn't received a Voter ID on time. So, she gets confused about her eligibility for voting? Can you clarify her doubt Condition for Eligibility as per Election Commission of India is (i) Eligible if age >=18 (i) Not Eligible if age <18

18 Swathi is working in a world famous pizza restaurant. Her manager ordered her to verify the size of the pizza such that it slices forms an exact triangle. She was given 3 values representing three angles of the slices cut down by chefs and she has to find out whether the slice is Valid or Not. Can you help her in finding it? Constraints: 30 <=anglel<= 90, 30 <=angle2<=90 30<=angle3<=90 Note: The Pizza Slice is Valid only if the sub of all the angle of the slice is equal to 180 degree.

19 Sivan's is teaching his son Vigneshwaran his daily lessons in their home. Vigneshwaran's mathematics homework note had a question named Mad angles where he need to check if some angles are given it is valid one to form a triangle. To make his son understand the problem sivan panned to write a simple programming logic for the same. Can you help sivan in doing so? Functional Description: The angles are valid to form a triangle if: Sun of all three angles are equal to 180 degree as well as angle1, angle2 and angle3 > 0

20 Vikram has just started Programming, he is in first year of Engineering. Vikram is reading about Relational Operators. Relational Operators are operators which check relationship between two values. Given two numerical values A and B you need to help Vikram in finding the relationship between them that is, First one is greater than second or, First one is less than second or, First and second one are equal.

21 Joslyn likes problems involving arrays. Unfortunately, the last one he tried to solve didn't quite get solved. Joslyn has an array A of N positive numbers. He wants to find the number of subarrays for which the sum and product of elements are equal. Please help Joslyn find this number.

22 Once N Men and M Women attended a matrimonial event. The event is represented by a matrix named "a" of N rows and M columns where Aij is 1 if the ith Men likes the ith Women Otherwise it will be 0. Note that it is not necessary that if a Men x likes Women y, then Women y should like Men x. If there are two different Men x and y, who both like Women z, then there will be a collision. Can you calculate the number of different collisions in the matrimonial event? Note that order of Men in the collision doesn't matter.

23 A Little Lion king and his friends from the Zoo like candies very much. There are N lions in the Zoo. The lion with number K (1 5 Ks N) will be happy if he receives at least AK candies. Overall there are C candies in the Zoo. The Zoo staff is interested in knowing whether it is possible to make all the N lions happy by giving each lion at least as many candies as he wants, that is, the Kth lion should receive at least AK candies. Each candy can be given to only one lion.

24 After setting up the area and his teddy bears. Valavan is up for playing his very first game. His first game is played on a NX N board with some initial sticks placed on each cell. He can move each stick in all four direction i.e up, down, left or right. His target of the game is to move all sticks to any one of the four corners in minimum moves (different sticks can be moved to different corners). Valavan seeks you again for his help. Your task is to write a program that tell the minimum number of moves given a particular state of board. NOTE: One cell may contain more than one sticks.

25 Ambikapathy wants to decorate his girlfriend Amaravathi's house with a series of lights. The number of lights is M. Initially, all the lights are switched off. Ambikapathy finds that there are K numbers of buttons, each of them is connected to a set of lights. Ambikapathy can press any of these buttons. When the button is pressed, it turns on all the lights it's connected to. Can Ambikapathy accomplish his task to switch on all the lights? If Ambikapathy presses the button such that some lights connected to it are already turned on, they do not change their state, i.e. remain turned on. Help him in his task to impress his valentine. Here lights are numbered from 1 to M.

26 You like tracking airplane flights a lot. Specifically, you maintain history of an airplane's flight at several instants and record them in your notebook. Today, you have recorded N such records h1, h2, ..., hn, denoting the heights of some airplane at several instants. These records mean that airplane was first flying on height h1, then started changing its height to h2, then from h2 to h3 and so on. The airplanes are usually on cruise control while descending or ascending, so you can assume that plane will smoothly increase/ decrease its height from hi to hi + 1 with a constant speed. You can see that during this period, the airplane will cover all possible heights in the range [min(hi, hi+1), maxſhi, hi+1)] (both inclusive). It is easy to see that the plane will be at all possible heights in the range exactly a single instant of time during this ascend/descend. You are interested in finding the maximum integer K such that the plane was at some height exactly K times during the flight 27 Fazil loves to preform different operations on arrays, and so being the Head of the higher education institution, he assigned a task to his new student Rohan. Rohan will be provided with an integer array A of size N and an integer K, where she needs to rotate the array in the right direction by K steps and then print the resultant array. As she is new to the school, please help her to complete the task.

28 The software tool is a repository of files, often the files for the source code of computer programs, with monitored access. Every change made to the source is tracked, along with who made the change, why they made it, and references to problems fixed, or enhancements introduced, by the change. Software tools are essential for any form of distributed, collaborative development. Whether it is the history of a wiki page or large software development project, the ability to track each change as it was made, and to reverse changes when necessary can make all the difference between a well managed and controlled process and an uncontrolled 'first come, first served' system. It can also serve as a mechanism for due diligence for software projects. In this problem we'll consider a simplified model of a development project. Let's suppose, that there are N source files in the project. All the source files are distinct and numbered from 1 to N. The tool, that is used for maintaining the project, contains two sequences of source files. The first sequence contains the source files, that are ignored by the tool. If a source file is not in the first sequence, then it's considered to be unignored. The second sequence contains the source files, that are tracked by the tool. If a source file is not in the second sequence, then it's considered to be untracked. A source file can either be or not be in any of these two sequences.

29 The hero of this story is Johan. Inspired by the legendary competitive coder Hardik, Johan has also started preparing to race to the top of the ranks. Johan is going to practice N different problems in the exact given order over the next M days. For each problem, he writes down the amount of time 'qi' he will take to think and code the 'ith' problem (He is quite good at estimating!). Before starting on the problems, he took advice from experienced competitive programmers on his practice routine and almost all of them advised him to keep his daily load at the minimum possible and avoid overtraining. Since Johan already has N problems to solve, he asks you to find the minimum time I such that training every day for a time "ti<=1" is sufficient to solve all the N problems in M days.

30 Ganapathy the Mathematics professor distributed the answer sheets for his students after the examination. His class had students who have passed the exam as well as the students who have failed in the exam. In order to have the proper analysis of individual student performances in his class he have ordered them to sit in the order were the students passed the exam should sit in ODD numbered row and the students who have failed in exam should sit in EVEN numbered row. The total number of rows in which students have to sit will be given by the professor. But since the dimension of the class is triangular in shape the students got confused. Can you help them with the order in which they have to sit if the number of rows is given by the Professor

31 Aaron has a number D containing only digits O's and 1's. He wants to make the number to have all the digits same. For that, he will change exactly one digit, i.e. from 0 to 1 or from 1 to 0. If it is possible to make all digits equal (either all O's or all I's) by flipping exactly 1 digit then output "Yes", else print "No" (quotes for clarity)

32 Janu and Ram are close friends who task a lot about life. They go though a lot of inspiring Quotes of Life". One fine day they had a small game.According to the game Ram will Read one of the Quote about life from the book and Jannu have to think a word about life in her mind without disclosing it to Ram. Finally once Ram completed reading the quoted Jannu will say if the word she thought in her mind is there in the Quote read by Ram. Can you convert the same scenario to a programming logic ? If the work thought by Jannu was present in the Quote then you have to print "Exists" else print "Dosen't Exists".

33 Every day, Selvan goes to his office by train and buys the ticket from the counter on the day of travel. On the ticket, there is a letter-code that is represented as a string of upper-case Latin letters. Selvan believes that the day will be successful in case exactly two different letters in the code alternate. Otherwise, he believes that the day will be unlucky. Please see note section for formal definition of alternating code. If the ticket code is given. Please determine, whether the day will be successful for Selvan or not. Print "Successful Day" or "Unsuccessful Day" (without quotes) corresponding to the situation.

34 Elavenil likes strings a lot but she likes palindromic strings even more. Today she found an old string 's' in his garage. The string is so old that some of its characters have faded and are unidentifiable now. Faded characters in the string are represented by '' whereas other characters are lower case Latin alphabets i.e ['a'-'z']. Elavenil being the palindrome lover decided to construct the lexicographically smallest palindrome by filling each of the faded character ('.') with a lower case Latin alphabet. Can you please help her complete the task

35 Arif likes to play volley ball. He found some statistics of matches which described who won the points in order A game shall be won by the player first scoring 11 points except in the case when both players have 10 points each, then the game shall be won by the first player subsequently gaining a lead of 2 points. Could you please help the Arif find out who the winner was from the given statistics? (It is guaranteed that statistics represent always a valid, finished match.)

36 Nathan wants to implement wildcard pattern matching supporting only the wildcard '?'. The wildcard character '?' can be substituted by any single lower case English letter for matching. He has two strings X and Y of equal length, made up of lower case letters and the character '?'. He wants to know whether the strings X and Y can be matched or not.

37

Mohit has no work to do in the kitchen, so he decided to play a card game with the following rules: Initially, N cards are placed in a row on a table. Each card is placed either face up or face down. The goal of the game is to remove all cards from the table, one by one. A card may be removed only if it is currently facing up. When a card is removed, its adjacent cards (the cards directly to its left and right, if they exist) are flipped, i.e. a card that was facing up will be facing down and vice versa. There is an empty space left behind each removed card, i.e. the remaining cards are not moved to create a contiguous row of cards again. Therefore, if the game starts with three cards and the middle card is removed, then the cards on the sides are flipped, but removing one of these cards afterwards does not cause the other card to be flipped, since it is only adjacent to the empty space created by removing the middle card. Determine whether Mohit is able to win this game. 38 Jeferson was given a string s of length 8 consisting solely of 'O's and 'l's. Assume that the characters of the string are written in a circular fashion. Jeferson need to find the number of O-1 or 1-0 transitions that one has to make while making a single traversal over the string. ie. start from any character and go circularly until you get back to the same character, and find the number of transitions that you made. The string is said to be said to be uniform if there are at most two such transitions. Otherwise, it is called non-uniform. Given the string s, tell whether the string is uniform or not.

39 Raju the fan of Great Mathematician Ramanujan developed an encoder that encodes the first 16 lowercase English letters using 4 bits each. The first bit (from the left) of the code is O if the letter lies among the first 8 letters, else it is 1, signifying that it lies among the last 8 letters. The second bit of the code is O if the letter lies among the first 4 letters of those 8 letters found in the previous step, else it's 1, signifying that it lies among the last 4 letters of those 8 letters. Similarly, the third and the fourth bit each signify the half in which the letter lies.

40 Afghanistan has surrounded by attackers. A truck enters the city. The driver claims the load is food and medicine from Pakistanis. Yasir is one of the soldier in Afghanistan. He doubts about the truck, maybe it's from the siege. He knows that a tag is valid if the sum of every two consecutive digits of it is even and its letter is not a vowel. If the tag is invalid then Yasir need to arrest the driver of the truck with invalid tab. If it is valid the truck is allowed inside the country. Can you help yasir in determine if he need to arrest or allow the truck? 41 Nancy, Simon, and Swati were all attending campus interviews. they got selected for the second round. Nancy failed to clear the second round and others to selected for the next round of interviews. Nancy discussed with her friend the question which came in the interview. one of the questions was, to create a program for the Fibonacci series. Nance doesn't know, how to solve it. But it's in the syllabus of his exam. So can you help to create a program in the specified concept to get an offer in the next interview ?. Functional Description: The recursive function should be used to find the Fibonacci series.

42 Simon is wasting electricity without caring about it. He leaves all switch on even when he is not in the room. After a Month of using Electricity, His security Guard informed him about Increased units of electricity. Due to the electricity bill, Simon gets tensed about his electricity bill. Simon willing to make the program for calculating the electricity bill for personal evaluation. can you help Simon to calculate his electric bill by taking the electric unit as an input?

43 Darsh seemingly down-to-earth guy. Dash has a Brother Nathan. Nathan leads a life of a computer hacker by day and a thief by night. One day, Nathan tries to break the door digital lock of Darsh's room. Darsh who wants to prevent it thinks to give Passcode for security. But it only accepts a perfect number as input. Can you help him to make a program for checking the given number is the perfect number or not...

44 Simon is studying B.Tech. Mechanical Engineering. He's going to attend a computer science-based subject exam this semester. Due to the less preparation in the previous monthly tests, his internal mark decreased. His computer science Professor made an offer one more chance to boost up his internal marks. Professor assigns a program to Simon for the internal mark bootup. So Simon wants to solve Questions of conversion from Binary to octal. can you help him in solving Questions by creating a function for the conversion of binary to octal?

45 Hassan gets a job in a software company in Hyderabad. The training period for the first three months is 20000 salary. Then incremented to 25000 salaries. Training is great but they will give you a programming task every day in three months. Hassan must finish it in the allotted time. His teammate Jocelyn gives him a task. What will be the value of the weight of a given number sequence? if Each number has a numeric index equal to its sum of digits, the weight of the sequence is equal to its sum of the product of the position of the number and its numeric index. For Example sequence of 6 nos is as follows: 12 31 45 13 56 67 Hassan was given a sequence S with unique elements, can you help him to write a code to help him determine the sequence 51, formed from S whose weight is maximum ?. As multiple sequences can be formed when numbers have the same numeric index. In this case, a maximum of 2 numbers will be given whose number index is the same. Print all the sequence, the first number should be the smallest number that occurs before greater.

46 Issac is a language teacher at a high school in Madurai. Sabari is a student, he is studying programming while during Language class. Issac tells Sabari to leave the other subject and learn Tamil. Sabari asked permission for 10 minutes, Finally, Sabri got permission to solve the program. The computer teacher has given homework on the topic of function and to write the program for conversion of days into year, weeks, and days. . But Sabari is not good at C Programming. Can you help him to solve the programming problem?

47 Mahendran is a manager, he has assigned a task to Nathan. Nathan is a purchase officer of this Financial organization. Nathan has given this task to a private company to design a computer keyboard for a Financial organization. the private vendor company has delivered the product to Nathans office. Nathan and the workers have tested the keyboard working condition. every part of the keyboard was perfect but when you press the on keys "7", it was replaced with "zero" and vice versa. Now purchase officer Nathan decided to return the product to a Private design company to correct the errors. can you help the designer to rectify the errors? You have to make a program to replace the number "7" where the "O" is present in the given number, then the company members will do the necessary steps to rectify the issue.

48 Aaron is an engineering graduate who received a call from the industry for an interview several months after graduation. So he was practicing the recursion method and he wants to test his skills on numbers. he found a set of numbers that has to be fed into a storage device where the sum of digits of numbers has to be found for memory management in the storage device. So the task to find the sum of digits in a number using recursion.

49 Simon wants a number plate for his Brand new luxury car. he likes it to be unrepeatable. He came through a display board about fibonacci series he wants to check to whether the number he wants to use for his car comes in fibonacci series or not. Can you help to them for program which checks if a number is present in fibonacci series or not using function.

50 Queen Advika is planning an attack on King Irfan's Dawn of Titans. King Irfan learns of this conspiracy from Karki Newton(bird) and plans to lock the single door through which the enemy can enter his kingdom. But, to lock the door he needs a digital key that is a palindrome. He starts to go through his box of integers, checking to see if they can be rearranged into a palindrome.

Mr. Naren Karthikeyan is a famous Fl driver in Tamil Nadu. He is participating in the world champion competition. He has increase speed in the car, also displays the arrow in the speedometer. After some time he is watching the speedometer through the mirror, the speed in the reverse order. he decided to practice the number in reverse order. So he decided to make a program for practicing the speed in the reverse order. Can you help him to make a program to display the reverse of the speed?

Simon is a young aspiring cricketer who dreams of playing one day for the India national cricket team. He is an diehard fan of Sachin and a game developer. He is currently designing a game that will include Modera Stadium, the largest stadium known to all. In this case the ball hit by the Simon must determine the weather inside or outside the field. Can you help him figure it out?

Meera is a food blogger and all her fans craves for the photos of the new restaurants and its dishes. Her manager has asked to tell the exact no of photos she is going to post at the end of weekend. If she posts 3 photos of a dish and there are n dishes at a restaurant. Can you help her calculate the total photos knowing she will go to 1 restaurant each day?

Jocelyn's skill is to write stories of letters. But she finds it very boring to write the story, and after three hours of work, Jocelyn realizes that what she wrote is full of A and B letters, and decides that the story will not end on time. So having a little fun with it, at least counting the bubbly words. Now Jocelyn connects the same pair of letters (A with A, B, and B) by drawing lines on the word. A given word bubble, if it is possible to combine each letter exactly with another letter so that it does not exceed two letters. Help Jocelyn figure out how many words bubbly.

Darsh, Ratik, Swathy are good friends. They are studying Prefinal year B.E. Electronics and Communication Engineering. Swathy's uncle was a maths teacher in a high school. He requested Swathy to make an application for identifying the greatest number with a numerator and denominator. You have to contribute for the development of the application. Can you do it?

Director Manirathnam wants to direct a movie on a high budget. So He was searching for a historical novels in the book shop. One of his friend PC Sreeram suggested him some of the best novels that can be converted into movie. Based on his suggestion Manirathnam has collected Name, Author, and Genre details of those books. Since the number of books is huge Manirathnam is seeking for your help in arranging the details collected by him in a particular format so that it will be helpful for him to move into story discussion. Can you help him?

Irfan is going to finish his final year master of computer application, he is in the final year of the course MCA. Every student has to participate in a department coding test to face on-campus interview activities. So Irfan plans to start a practice of a code with a simple calculation of identifying +ve and -ve numbers. Can you help Irfan by developing the application for finding the nature of the number?

Aarav, Advika, binitta are good friends. They are studying final year B.E. Computer Science and Engineering. They want to develop an application to order student details in ascending order which will be useful for the high school in the village they belong to. Can you help them in the application development?

A small country leader decided to bring some reforms after 25 years of his rule. So as to engage the educated and unemployed youth of that country in this matter. He Ordered young people to create an application to assess citizen's eligibility for voting. You too can contribute in this initiative. Can you help them with the application they wanted? Functional Description: If the age is below 18 and above 60 then the citizen of the country is “Not Eligible” for voting If the age is greater than 18 less than or equal to 60 the citizen of the country is "Eligible" for voting.

In the year 2065, a scientist invents the time machine. To prove its capability, he sends it back in time to 2020, programming it to return within a particular hour. However, the machine does not return. The time machine is seen by Selvan he is a writer. Selvan is involved in an accident and witnesses the time machine while recovering from the shock. While Selvan decides to keep the time machine for himself and written as a frame narrative. The work is generally credited with the popularization of the concept of time travel by using a vehicle that allows an operator to travel purposely and selectively forwards or backward in time. The Time Machine has been adapted into three feature films of the same name, as well as two television versions, and a large number of comic book adaptations. It has also indirectly inspired many more works of fiction in many media productions. Now kindly help our Captain of the Ship "Selvan" to calculate the difference between the two-time machines. 61. Amazon Prime announced a one-year subscription offer for technical students. we will provide two numbers for the addition that must be use call by reference. If the answer is correct for this question, you will get the offer. Can you complete the task to win this competition?

Mukesh has given an array al, a2..., an to Mahesh. Mahesh can remove at most one subsegment from it. The remaining elements should be pairwise distinct. In other words, at most one time Mahesh can choose two integers l and r (1slsrsn) and delete integers al,al+1,...,ar from the array. The remaining elements should be pairwise distinct.

Selvan went to the German for participating in the reality game show. He wants to qualify as participants among all country students. if he gets cleared the coding part then only he will be eligible for the next level. He got the questions like, you have to read in an array of integers sequentially and print its elements in reverse order. Now Selvan wants to identify the logic of the coding part using a pointer and he has to display the correct result then only he can participate in the game show.

Arif and Selvan both are friends. Both are planning to utilize the vacation holidays by learning a programming language. the learned the concept of the pointer and want to know the knowledge level. So they decided to make a coding test for each other. Arif wrote a name in the paper, Caleb wants to count the vowels and consonants. Can you help Selvan?

Murugan has given a sequence of integers al, a2,...,an to his brother Vinayak. Vinayak needs to paint elements in colors, so that: If we consider any color, all elements of this color must be divisible by the minimal element of this color. The number of used colors must be minimized. For example, it's fine to paint elements [40,10,60] in a single color, because they are all divisible by 10. Vinayak can use any color an arbitrary amount of times (in particular, it is allowed to use color only once). The elements painted in one color do not need to be consecutive. For example, if a=[6,2,3,4,12] then two colors are required: let's paint 6, 3, and 12 in the first color (6,3, and 12 are divisible by 3) and paint 2 and 4 in the second color (2 and 4 are divisible by 2). For example, if a=[10,7,15] then 3 colors are required (we can simply paint each element in a unique color).

Mohan is very particular about numbers. There are 'K' digits that he dislikes: D1, D2,...Dk. Mohan is shopping, and now paying at the cashier. His total is 'N' yen (the currency of Japan), thus he has to hand at least 'N' yen to the cashier (and possibly receive the change). However, as mentioned before, he is very particular about numbers. When he hands money to the cashier, the decimal notation of the amount must not contain any digits that he dislikes. Under this condition, he will hand the minimum amount of money. 67. Arif and Selvan both are friends. Both are planning to utilize the vacation holidays by learning a programming language. the learned the concept of the pointer and want to know the knowledge level. So they decided to make a coding test for each other. Arif wrote a name ending with numbers in the paper. Selvan wants to identify the total length of the input. Can you help Selvan?

Apart from having lots of vacations throughout the year, residents of India also have whole fortune years. The year is considered a fortune if it has no more than 1 non-zero digit in its number. So years 100, 40000, 5 are lucky and 12, 3001, and 12345 are not. You are given the current year in India. Your task is to find how long will residents of India wait till the next fortune year.

A video player plays a game in which the character competes in a hurdle race. Hurdles are of varying heights, and the characters have a maximum height they can jump. There is a magic potion they can take that will increase their maximum jump height by 'l' unit for each dose. How many doses of the potion must the character take to be able to jump all of the hurdles. If the character can already clear all of the hurdles, return 0.

Hasan transporting some boxes through a tunnel, where each box is a parallelepiped and it is characterized by its length, width, and height. The height of the tunnel 42 feet and the width can be assumed to be infinite. A box can be carried through the tunnel only if its height is strictly less than the tunnel's height. Find the volume of each box that can be successfully transported to the other end of the tunnel. Note: Boxes cannot be rotated.

B.Tech students going to make their own higher studies application. The application must perform two types of operations: add a name, where name is a string denoting a Student name. This must store the name as a new Studentin the application. find partial, where partial is a string denoting a partial name to search the application for. It must count the number of Students starting with partial and print the count on a new line. Given n sequential add and find operations, perform each operation in order.

Simon has a string s of length n . He decides to make the following modification to the string: Pick an integer k, (1sksn). For i from 1 to n-k+1 , reverse the substring s[i:i+k-1] of s. For example, if string s is qwer and k=2, below is the series of transformations the string goes through: qwer (original string) wqer (after reversing the first substring of length 2) wear (after reversing the second substring of length 2) werq (after reversing the last substring of length 2) Simon wants to choose a k such that the string obtained after the above mentioned modification is lexicographically the smallest possible among all choices of k. Among all such k, he wants to choose the smallest one. Since he is busy attending Felicity 2020, he asks for your help. A string a is lexicographically smaller than a string b if and only if one of the following holds: a is a prefix of b, but a+b; in the first position where a and b differ, the string a has a letter that appears earlier in the alphabet than the corresponding letter in b.

Mithran has an array of lengths n. He has just enough free time to make a new array consisting of n copies of the old array, written back-to-back. What will be the length of the new array's longest increasing subsequence? A sequence a is a subsequence of an array b if a can be obtained from b by deletion of several (possibly, zero or all) elements. The longest increasing subsequence of an array is the longest subsequence such that its elements are ordered in strictly increasing order.

Recently, Bharani met with Dharani in a philatelic store, and since then they are collecting coins together. Their favorite occupation is to sort collections of coins. Dharani likes having things in order, that is why he wants his coins to be arranged in a row in such a way that firstly come coins out of circulation, and then come coins still in circulation. For arranging coins Bharani uses the following algorithm. One step of his algorithm looks like the following: He looks through all the coins from left to right; If he sees that the ith coin is still in circulation, and (i + 1)-th coin is already out of circulation, he exchanges these two coins and continues watching coins from (i + 1)th. Bharani repeats the procedure above until it happens that no two coins were exchanged during this procedure. Bharani calls hardness of ordering the number of steps required for him according to the algorithm above to sort the sequence, e.g. the number of times he looks through the coins from the very beginning. For example, for the ordered sequence hardness of ordering equals one. Today Dharani invited Bharani and proposed him a game. First he puts n coins in a row, all of them are out of circulation. Then Dharani chooses one of the coins out of circulation and replaces it with a coin in circulation for n times. During this process Dharani constantly asks Bharani what is the hardness of ordering of the sequence. The task is more complicated because Bharani should not touch the coins and he should determine hardness of ordering in his mind. Help Bharani with this task.

One day Anna got the following task at schools to arrange several numbers in a circle so that any two neighboring numbers differs exactly by 1. Anna was given several numbers and arranged them in a circle to fulfill the task. Then she wanted to check if she had arranged the numbers correctly, but at this point her younger sister Maria came and shuffled all numbers. Anna got sick with anger but what's done is done and the results of her work had been destroyed. But please tell Anna: could she have hypothetically completed the task using all those given numbers?

Priya got a new doll these days. It can even walk! Priya has built a maze for the doll and wants to test it. The maze is a grid with n rows and m columns. There are k obstacles, the i th of them is on the cell (xi,yi), which means the cell in the intersection of the xi -th row and the yi -th column. However, the doll is clumsy in some ways. It can only walk straight or turn right at most once in the same cell (including the start cell). It cannot get into a cell with an obstacle or get out of the maze.

Ramesh have been given an array A of size N and an integer K. This array consists of N integers ranging from 1 to 10^7. Each element in this array is said to have a Special Weight. The special weight of an element a[i] is a[i]%k. Ramesh now need to sort this array in Non-Increasing order of the weight of each element, ie the element with the highest weight should appear first, then the element with the second highest weight and so on. In case two elements have the same weight, the one with the lower value should appear in the output first.

The brave Knight came to the King and asked permission to marry the princess. The King knew that the Knight was brave, but he also wanted to know if he was smart enough. So he asked him to solve the following task. There is a permutation pi of numbers from 1 to 2n . You can make two types of operations. Swap pl and p2, p3 and p4, ..., p2n-1 and p2n. Swap pl and pn+1, p2 and pn+2, ..., pn and p2n. The task is to find the minimal number of operations required to sort the given permutation. The Knight was not that smart actually, but quite charming, so the princess asks you to help him to solve the King's task.

Dr. Abdul Kalam is a Professor at a top university. There are n students under Kalam supervision, the programming skill of the ith student is ai. Kalam has to form k teams for yet another new programming competition. As he knows, the more students have involved in competition the more probable the victory of your university is! So Kalam has to form no more than k (and at least one) non-empty team so that the total number of students in them is maximized. But Kalam also knows that each team should be balanced. It means that the programming skill of each pair of students in each team should differ by no more than 5. Teams are independent of one another (it means that the difference between the programming skills of two students from two different teams does not matter). It is possible that some students not be included in any team at all. Your task is to report the maximum possible total number of students in no more than kk (and at least one) non-empty balanced teams.

Mr. Kamal has a teacher at CBSE School. There are n students under Kamal supervision, the programming skill of the ith student is ai. Kamal to create a team for a new programming competition. As he know, the more students some team has the more probable its victory is! So he has to create a team with the maximum number of students. But you also know that a team should be balanced. It means that the programming skill of each pair of students in a created team should differ by no more than 5. Your task is to report the maximum possible number of students in a balanced team.

Festember 2021 is coming! Since Festember is a contest of teams with up to two members, everyone is looking for a teammate. There are N contestants (numbered 1 through N) who want to participate in Festember, let's denote the skill level of the ith contestant by Si. These people want to pair up in N/2 teams; each team should consist of two people. Clearly everyone wishes for their teammate to be as skilled as possible, so everyone wants to maximize their teammate's skill level. We call a pairing (an unordered N/2-tuple of teams) valid if there are no two teams consisting of people (A,B) and (C,D) such that SD>SB and SA>SC – in that case, A and D would both prefer to be on the same team rather than with their current teammates.

One fine day when surya returned to his hometown he met Megna and had a crush on her. After a weeks time Megana went to America. So Surya too decided to go to America. There are N cities in America and they are numbered from 1 to N, each city has coordinates on plane, i-th city is in (Xi, Yi). Surya is in first city and he wants to visit some cities by his car in the trip but the final destination should be N-th city and the sequence of cities he will visit should be increasing in index li.e. if he is in city i he can move to city j if and only if i <j). Visiting ith city will increase Surya's happiness by Fi units (including first and last cities), also Surya doesn't like traveling too much, so his happiness will decrease by total distance traveled by him. Help Surya by choosing a sequence of cities to visit which maximizes his happiness.

Most of the the popular Universities has the following grading policy: Every student receives a grade in the inclusive range from 'O' to '100'. Any grade less than '40' is a failing grade. Nathan is a professor at one such university and likes to round each student's 'grade' according to these rules: If the difference between the 'grade' and the next multiple of '5' is less than '3', round 'grade' up to the next multiple of '5'. If the value of grade' is less than '38', no rounding occurs as the result will still be a failing grade. Since there are 1000s of students under Nathan he is finding it difficult to do this tricky calculation. Can you help Nathan in the calculation

Binita has given two numbers, namely M and N to Britta. Britta wants to find the number of ways in which the numbers that are greater than or equal to S can be added to get the sum A. Print the result as modulo 1019 + 9.

Thalappakatti biryani is the tastiest Biryani to exist, and the reason for that is his special, Seeraga samba. Seeraga samba can be grown in rectangular patches of any side lengths. However, The owner only has a limited amount of land. Consider the entire town of Dindigul to be consisting of cells in a rectangular grid of positive coordinates. The owner own all cells (x,y) that satisfy x*ysN As an example if N=4, The owner owns the following cells: (1,1),(1,2),(1,3),(1,4),(2,1),(2,2),(3,1),(4,1) The owner can only grow Seeraga samba in rectangular patches consisting only of cells which belong to him. Also, if he uses a cell, he must use it entirely. He cannot use only a portion of it.

Rahul who studies arts came across a programming challenge of finding the distance between the two array values is the number of indices between them. Given 'a', find the minimum distance between any pair of equal elements in the array. If no such value exists, return-1

Shah is an road side cloth seller. There is a large pile of socks that must be paired by color for sale. Given an array of integers representing the color of each sock, determine how many pairs of socks with matching colors there are. Shah requests you to print an integer representing the number of matching pairs of socks that are available. Can you do it?

Two lions and a hyena are at various positions on a line. You will be given their starting positions. Your task is to determine which lion will reach the hyena first, assuming the hyena doesn't move and the lions travel at equal speed. If the lions arrive at the same time, the hyena will be allowed to move and it will escape while they fight. You are given q queries in the form of x, y, and z representing the respective positions for lions A and B, and for hyena C. Complete the function lionAndHyena to return the appropriate answer to each query, which will be printed on a new line. If lion A catches the hyena first, print Lion A. If lion B catches the hyena first, print Lion B. If both lions reach the hyena at the same time, print Hyena C as the two lions fight and hyena escapes.

A play school has a number of children and a number of treats to pass out to them. Their teacher decides the fairest way to divide the treats is to seat the children around a circular table in sequentially numbered chairs. A chair number will be drawn from a hat. Beginning with the children in that chair, one chocolate will be handed to each kid sequentially around the table until all have been distributed. The teacher is playing a little joke, though. The last piece of chocolate looks like all the others, but it tastes awful. Determine the chair number occupied by the child who will receive that chocolate.

Dharma has two arrays, 'A' and 'B', both containing 'N' integers. A pair of indices (i, j) is beautiful if the 'ith' element of array 'A' is equal to the 'ith' element of array 'B'. In other words, pair (i, j) is beautiful if and only if A[i] = B[j]. A set containing beautiful pairs is called a beautiful set. A beautiful set is called pairwise disjoint if for every pair ([], [i]) belonging to the set there is no repetition of either I[i] or r[i] values. For instance, if A= [10,11,12,5,14] and B= [8,9,11,11,5] the beautiful set [(1,2),(1,3),(3,4)] is not pairwise disjoint as there is a repetition of 'l', that is I[0][0] = 1[1][0]. Your task is to change exactly 'l'element in 'B' so that the size of the pairwise disjoint beautiful set is maximum. It should return an integer that represents the maximum number of pairwise disjoint beautiful pairs that can be formed.

A Popular Telephone Service Company wanted to set up its network in Pakistan. Pakistan has N cities. The company wants to join those cities with an end-to-end network. But the problem in Pakistan is that the adjacent cities are enemies and does not wants to unite through the network. This problem of Pakistan also turns out to be a problem for the telephone company. Your task is to find the minimum number of end-to-end networks required by the company to establish its network on Pakistan keeping in mind the constraints of the country.

Ameer is afraid of number 21 and if he comes across that number then he may faint and you can not let it happen. You do not want him to face a number that has 21 as a part of them or in the worst case possible is divisible by 21. If he ends up facing such a number he feels sad... and no one wants that - because he starts chanting "NUMBER 21" if the number doesn't make him feel sad he says "I AM SAFE".

Araov was given a problem to solve, by his brother Dharma. The problem was like, given integers, N and K, Araoy has to find the number (possibilities) of non-increasing arrays of length K, where each element of the array is between 1 and N (both inclusive). He was confused, regarding this problem. So, help him solve the problem, so that, he can give the answer of the problem, to his brother Dharma. Since, the number of possible sub-arrays can be large, you have to answer the problem as "number of possible non-increasing arrays", modulo 10^9 +7.

Amrish is a brilliant student who has a huge interest in coding. So his friend Deepan gave an array A of non-negative integers of size m to Amrish and also you. So your task is to sort the array in non-decreasing order and print out the original indices of the new sorted array. Assume the input array as A={4,5,3,7,1} After sorting the new array becomes A={1,3,4,5,7). The required output should be "4 2013" (Without Quotes)

Consider an analog clock whose hour and minute hands are A and B centimeters long, respectively. An endpoint of the hour hand and an endpoint of the minute hand are fixed at the same point, around which each hand rotates clockwise at constant angular velocity. It takes the hour and minute hands 12 hours and 1 hour to make one full rotation, respectively. At O'o clock, the two hands overlap each other. H hours and M minutes later, what is the distance in centimeters between the unfixed endpoints of the hands?

Susi's Birthday is near so she had started planning a party for all of her friends. Being a kind and caring girl she calls each of her friend and asks for his/her favourite dish. Now each friend has own liking/disliking for different dishes. A friend can only like or dislike a dish it means if we are having three dishes 1,2,3 then if a friend says that he likes Dishes 1 and 2 then its obvious that he dislikes Dish 3. So for each friend we are given a string of 1 and 0 where I shows that this person like this particular dish. Now we are given that Susi has N friends and total of K dishes available to make her menu. Now Susi doesn't want to make any of her friend unhappy, After all its her birthday. So she got confused on what dishes to count in menu and calls you for help. You need to find count of minimum dishes to order so that all of her N friends are happy which means everyone has at least one dish to eat in party. Note: Its for sure that everyone has at least liking for one dish.

Fahad's Birthday is a week ahead. Arav and his friends are planning to give him a birthday party. For that Arav's friends want him to buy the cake. He needs to pay 'x' amount of money to buy the Blackforest cake on the first day. After each day has passed, the Blackforest cake becomes 'x' times the price that it was on the previous day. For buying the Blackforest cake Arav has to collect money from all the friends and for that, he need 'y' days and after 'y' days he will go and buy the Blackforest cake. Arav seeks your help in calculating the price of Blackforest cake on the yth day. Take the price as modulo 109 + 7 as the price can be very large.

Anandi is involved in developing a new web browser After many sleepless nights she finishes most of the modules of her new web browser and only server error pages notification module is left out. She is planning to launch her browser within a weeks time. So can you help her to complete the error page module? Functional Description: 400-BAD REQUEST 401-UNAUTHORIZED 403-FORBIDDEN 404-Not Found 500-Internal Server Error

Rohan has been given an array A of size N. Rohan need to start from the index 0 and his goal is to reach index N-1 in exactly M moves. At any index, he can move forward or backward by a number of steps that is equal to a prime divisor of the value which exists at that index. Rohan cannot go beyond the array while going forward or backward. Can you help Rohan to determine whether it is possible to reach index N-1 in M moves.

Rohan wanted to distribute 'N' Dragon Fruits among people according to the following conditions:

  1. You can select the number of people that receive Dragon Fruits.
  2. Each person should get more than one Dragon Fruit. 3.One person cannot receive all the Dragon Fruits. 4.All the 'N' Dragon Fruits must be distributed.
  3. Each person can only receive an integral number of Dragon Fruits. Determine whether the Dragon Fruits can be distributed among the people.