0% found this document useful (1 vote)
173 views

Coding Challenges INSTACKS

Uploaded by

donga srinivas
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (1 vote)
173 views

Coding Challenges INSTACKS

Uploaded by

donga srinivas
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 33
Bingo-Online Lottery Game 00:57:47 Difficulty: easy Max Points: 10 Description A game company has designed an online lottery game, Bingo. In this game, N number cards are displayed. Each card has a value on it. The value can be negative or positive. The player must choose two cards. To win the game, the product of the values of the two cards must be the maximum value possible for any pair of cards in the display. The winning amount will be the sum of the two cards chosen by the player. Write an algorithm to find the winning amount as the sum of the values of the two cards whose product value is maximum, Input The first line of the input consists of an integer numCards, representing the number of cards (N). The second line consists of N space-separated integers -....., val1,, val2..., valN. representing the values on the cards. Output Print an integer representing the sum of the values of the two cards whose product value is maximum. or areca ee ee) andang peszedx3 andr saseo ysa1 ouland ‘61 Stspueo payaajas au Jo sanjen ayy yo wns aun ‘os ‘0146 21/06 51 Sanjen o4g Jo ronpoud wnwixew ou uoneueldx3 6 andino o1ec-o-8e-6L anduy ajduiex3, ett om Example Input: s2an7624 Output: 8 Explan: Bis the maximum digit value in the given item ID. So, the outputs 8. Public Test Cases + Input Expected output 1 32387634 8 jigital Secure Data Transfer Solutions Difficulty: easy Max Points: 10 Description ‘The company Digital Secure Data Transfer Solutions provides data encryption and data sharing services. ‘Their process uses a key K for encryption when tranemitting characters. To encrypt a character, the character is replaced by the following Kth character with the same case in the English alphabet set. The English alphabetical set is considered in a cyclic fashion for the last K characters. Write an algorithm to find the character used to encrypt the given character. Input The input consists of a space-separated character and integer - character and key, representing the character to be transmitted, and the key (K), respectively. Output Print @ character representing the encrypted character. Constraints NA andgno peyzedxa andur * saseg yal o1IGNg ‘9 st andino ayy ‘og ‘9 ung soeidey uoneueidxg ‘9.andino eq induy ajdwexg Encode as Number 00:59:45 Difficulty: easy Max Points: 10 Description A company wishes to encodes its data. The data is in the form of a number. They wish to encode the data with respect to a specific digit. They wish to count the number of times the specific digit reoccurs in the given data so that they can encode the data accordingly. Write an algorithm to find the count of the specific digit in the given data. Input The input consists of two space-separated integers- data and digit, representing the data to be encoded and the digit to be counted in the data. Output Print an integer representing the count of the specific digit. é € E€zBLECLS t andano pa32adx3 andur # sase9 3591 S1IGNd #6 S} ndino ayy og “elep aup UI Sawn damp pareada St € YIP Sy. uoneuedxg e andino eZBLEZLS du aidwexg Energy in Science Lab 00:42:05 Diticuty: easy (Max Points: 10 Description Ina science research ab, the combination of two nuclear substances produces an ital energy A. This energy A changes ata consistent ‘ate Revery second. The energy gets multiplied by a constant value R every second, The scientist wishes to calculate the energy produced at every se00nd ithe reaction is allowed to happen fr N seconds, Write an algorithm to find the energy produced at every second if he reaction i allowed to happen for N seconds. Input The input consists of tree space-separated integers ~intialEnergy, rate and time. representing the intial energy produced on combining the nuclear substances (A), the consistent rte of change (Rand the seconds for which the reaction is allowed to happen (N), sespectively. output Print N space separate integers representing the energy produced at every second ithe reaction is allowed to happen for N seconds, Constraints 106cintialEnergyrate « 106 spars ees 1 andar porsedns andur ® seseg yea nang Sr si'ss1noau os ‘5 S2100891 06 anjen ABiousSnovaid 24.01 pada 8 ¢ UDR =n JO} S51 Sow0009 105 101 pads ¢ Jo ores atssU09 e'Z=N 03 pareioue8 8150. yue "i= N04 uoneueydxg srsis anu adie Garments company Apparel Dittcuty: easy Max Points: 10 Description ‘The garments company Apparel wishes fo open outlets at various locations. The company shortisted several plots in these locations and ‘wishes to select only pots that are square-shaped We an algrithm ta help Apparel find the number of plats that itcan select forts outlets Input “The first line ofthe nput consists of an integer numOfMots, representing the numberof pots shortlisted by the company for outlets (N} The second ine consists of N space-separated integers areal area... areaN representing the area of the N pots selected for outlets. output Print an integer representing the number of plots that wll be selected for outlets. Constraints 0 S!aquinNpuooes> 1oquiMNISiy >601- ‘squjensuog ‘sraquinu ani6 jo aBues ayy u suaquinu awd ysajjews pue 1s96se] ay2 Jo wns ayn Gunuasaides soGoyU! Ue Lug anding ‘964e1 a\p Ul parap|suoo ave siequunu yiog 4esn alp Aq paseILe SreqUINU omy ‘at Bunuasaidas ‘aqunnypuooss pue Jaquunnisiy — s136aqu pajesedas-aoeds omy Jo S'siSu0O Indu! ay, anduy 410 atp puy 0} wYALOBje Ue ayupA ‘slaquinu palaiue-19sn aly Jo a6uel aft ul sanjen awd yews aq jaua6 WnuujUIWY a4p pue WRULEeW AYR Jo LNs axg se pareINO}EO S! dLO AY, JAqUIMU pUODAS ayy LENA, ‘shemje pinoys paveiue Joquinu ysiy 844 “ssequUnU Wopues OM s81U 01 payse 2% in ayy 10 404 ‘suIp Jo saquinu {ue 2q Ue0 dL0 au ‘suoNeWyLOD Japi0 40} uoNeseUa6 (plowssed auLI| 2UO) do Jo aways aU @ quawwaydus! 0} uajd fay, “ssaooud Bsuapio sy aoueyUD o} SaysiM ays aosaUILHOD-2 UY seq OF :stujog xew ‘Ase :Aynousia Sb:8S:00 P4omssed aul, 2UO os 2s es t andang paazadx3 sdur * saseg isa a1/GNd oss S1Lp pue £6 J0 wns ay) onnsadsas ‘Up pue £6- ave Sioquiny UaAI ay) uy) Siaquinu auiud a6. pu uoneueidx3, os anding 0s Ls: andy ajdwexa, andy aiduex3 ‘swurensuog, ‘uno 1 oy ssaqunu 199140 1nd a se poie|noeD 1 JoquINY ei Jo YeHOIDE) OY ion ‘voquina vaA6 a jo fev0128 948 S018? Buen Jo Nea ayn BuNesa1s 9601 Uy Wald nding ‘oatns 9 uo pareysip soqunw 9p Bunuasasday nu 989qu Ue Jo ss}8UeD Ind OY andy vequnu a6 aun joann ovorse} 2 u 0122 Buen 24 No» OL uNAHOB}e Ue aH sBqUMU LON aX j0 afer HOIDe} an UY So. Buy ‘94110909 a ney n0K Ue 24 Yo 9p10U UBB! ax UO Pahe|dsPs}siaquIU Baw aU '=RUED 9ujUO UE BUS 18 NOs uonduosaq ob ssiiog xen seo :Aunoua zy::00 auieg oul Example Input 5 Output 1 Explanation On calculating the factorial of 5, the output is 120 (1 x2xx4xS). There is only one traling On 120, othe output is Public Test Cases. * Input Expected output Pooled cab service 00:44:40 Difficulty: easy Max Points: 10 Description ‘A.company wishes to provide cab service for their N employees. The employees have distance ranging from 0 to N-1. The company has calculated the total distance from an employee's residence to the company, considering the path to be followed by the cab is a staight path. The distance of the company from itself is 0. The distance for the employees who live to the let side ofthe company is represented with @ negative sign. The distance for the employees who live to the right side ofthe company is represented with a positive sign. The cab wl pe alorcea a range or alstance. The company wishes to fn the alstance for the employees who Ie within the particular stance range. Write an algorithm to find the distance for the employees who live within the distance range, Input The first line of the input consists of three space-separated integers-num, start and end representing the sizeof the list (N); the starting value of the range: and the ending value of the range, respectively. The second line of the input consists of N space separated integers representing the distances of the employees from the company. output Print space-separated integers representing the distance for employees whose distance lies within the given range else return 1. Constraints NA 5 6€ ev 7 8¢ 6 6c ay 8e os 0c 9 1 andano pe32063 ardur * ‘ease 1891 oNand ‘260 ua au yu Sy sayy ayn wos B2UESIpasoUN 6 PUE By "BE SEOURIEP LAIN soaKoyus BON aI B24 uoneuelaea ccar ee ading os0e9 apd oidwexa SecretMessage agency 00:59:42 Ditticuty: easy Max Points: 10 Description SecretMessage agency provides message encoding and decoding services for secure data transfer. The first step in decoding includes removal of special characters and the whitespaces from the message, as special characters and whitespaces do not hold any meaning, Write an algorithm to help the agency find the number of special characters and whitespaces in a given. message. Input The input consists of a string message, representing the message that need to be decoded by the agency. Output Print an integer representing the number of special characters and whitespaces present ina given, message. Constraints NA ’ S1PSsAg@psBBse8 ndyno payzedxa andur # saseg 359 OF (©) a1e Burueew ou Buiney sieoe.eyo jeloads au, uoneueldxg v nding ssipsosa#@ys65seb anduy aydwiex3 andy sraquinu g 4036 & jo sway qaoelpe usamiaq aoueip je}0) 2 Dupuy eidwex3, WN squensuog ‘Josuoo atn wo} ndul ayer 1 paysonba1 ou ave no, esy fexre

You might also like