# DAA 16 Aug Lab

- **Course:** 5101 - Design & Analysis of Algo
- **Recorded:** 2026-08-16 00:00
- **Transcript:** 755 segments, 11844 words
- **Made by:** deepdml/faster-whisper-large-v3-turbo-ct2

---
Oh, reminder. Saurav Kumar Pandey. Thank you. I'll also spam the HackerRank link as you guys. Okay. Because I'm in Genji. Okay. So please go through this link. Okay. If you don't have any account, please register your account either by your personal email ID or by your IITPathna email ID. Okay. then what you will do your naming convention should be like a how you have to name yourself like a your role number underscore your name that's it okay you just have to name if this not fit okay your role number only and underscore that's it okay you will have to name like that your ID this is 5 times people understand no roll number underscore name only roll number yeah wow Arya please give us an example nice not your name Udit Nayar okay maybe your ancestors name sister's name what i can do like your name only right and sisters and brothers okay those names you can add so that i can find good no worries asius okay you missed the lame jokes maybe okay

you didn't miss anything if you if you joined lead okay so let me share you the screen i hope you can access the link also hey confirm this okay please spam it okay if you if you can able to access the link right whoi-kohi to register bhi nahi kya hoga unko mein pooch raho access karre hogi link you know accessible please stop the messages guys yes yes able to access the link please please uh uh so so we'll start at the 11 24 okay like uh for 500 people i'm giving like a three minutes of a time to create an account okay and we'll start the class we'll go through this link what are the questions are there we'll solve that okay and we'll tell you what we are going to do in like what we are going to cover in this class okay and upcoming classes okay so yeah we'll discuss that getting error while registering doesn't exist in a tenant hacker rank what the heck is this okay no issues if you cannot able to uh avinesh if you cannot able to join in your account iitp

you can join through your personal email id okay yeah you can join through your personal email id no in your name only role numbers would be empty okay you can lift the empty if They are asking, okay, signed up, two questions are showing, okay. Okay, so you can go to the chat GPTC and solve it. So you can go, sir, signed up, two questions are showing, sir, two questions are solved. That's it. So, yeah, class, how to find the role number? You joined through your, like a personal ID, I don't know how you joined, okay. but you got an email id okay and from that email first one is your name okay like if your name is palak then palak is your name palak underscore then your email id is there okay that's it okay you see like punit goes gave an example who is who is asking for the example i don't know nice it's her last name oh last name below cool stream last name is your family name right i think recording was started okay no issues oh it's 11 24 let me say my stream okay

okay okay before that like i want to ask like a how many of you are from like a coding background me me me i am how many you are not from coding background okay i'm not good no okay can you disable the notification sound yeah sure why not can you sign up hey let's start the class i think okay we are very which one yeah i think this one hey guys hope you can see my screen okay nice i don't know why people are joining now there's a comment section chat yes i can cite my chat here so that i can see okay 600 people wow yes 60s dwellers okay even i have to sign up crazy okay so what is the question and like hope you can see and understand the question at least this is a simple question okay if you will go through two of those questions as i already said the link okay so these are the very simple question like you have to find the minimum and maximum of indian array okay hope you're aware of and remember guys we are going to solve

this question only in a python okay uh you have taken the ai uh ai and ds right course so i'm assuming that you will be like java abhi abhi sabko matlab ki goal dikhega like kya bolta hai excuses dikhega ki sir ismei solve karo usmei solve karo hata nahi hai but main thing is to understand the logic ya like if you can can able to catch up the logic can do it okay you can solve okay so we'll go through the question first okay okay I'll take the doubts and and raise in the last only okay after solving one question i'll take the doubt okay after that i'll take i i'll solve another question then i'll take another doubt okay correct i'm going to i'm trying to click the reject button then realize it's your scroll wow crazy gosh okay so you've given one error okay so first of all let let me go through you one what is what is an array okay you know what is in python okay python is a snake again python is not a snake python is a coding language

okay which we are going to solve okay array you know what is an error okay like data structure yes you can store similar kind of data yes can you speak please only in English sure why not I will speak but in between that I will also speak in Hindi there is no initiatives I'm sorry VV type right okay so this this this is the link okay so I mean look cast or guys okay like those who are coming from non-background okay I'll teach in a purely a b c d manner okay so you can able to understand okay if you cannot able to so an array is in data sector as already told by someone okay use to store the multiple values in a single variable okay usually in an order sequence okay so let's say you want to store some list of items like a okay and then if you want to store then you have to make a variable then you can store but you can store directly you can call one variable array okay and then you have to just put your like a square braces then you can store the values in a string okay like that

so array is also having an index okay each element has an by the way maybe the coding who is coming from the coding background it may be like a boring to you because like a i'm also considering like a uh i'm also considering the non-coding background so i have to teach in that manner so that they can able to also understand okay so hope you can understand guys okay so you can you can sit okay you can attend the class meanwhile you can do other work also okay meanwhile if this board to you so so index uh so array is having some index also okay so each element has a position called an index and we are starting from the zero index value okay and uh yeah why do we use array so specifically like what's the question like suppose you have a like a marks of five student okay you want to store like a so instead of storing in a five separate values okay or like five separate variables you we have only one variable

containing five values that is better right and we can also use the loop to call this value directly okay so that is better right so that's why we are using array okay got it showing an error bro i can't do anything with this asses and uh yeah one other thing okay why does an array start at a zero index can anyone tell like a system by the way thanks to those folks who is helping in between okay in the comment okay to the other guys who is facing errors yeah uh okay where we are like huh i'm asking a question like why does an array start an index zero okay so so let me let me so like write some some things here like hope you can understand okay there uh like you want to store some marks you can store like this by calling by the way this should be array okay okay you can store it like this and each as i told like each array is having some positions values so 0 1 2 3 okay good right so an array index represents like a distance

from the beginning of the array okay so suppose we have a like a 10 20 30 40 as i have written so thinkable it is like a memory value okay so underneath it will store like a it will go go to one uh offset okay and it will store okay if you if you study about the computer organization and architecture okay there is a term called offset okay so it will store in that offset value okay each variable is going in that offset and offset is positioned like that so it is starting from the zero positions okay so so first element is in zero position away from the beginning like a 10 is like a offset 0 20 is like offset 1 30 is like offset 2 and 40s what is like it i'm sorry what is like a offset three okay so that's why so you can think of it's like a what we can say you can think of it's like uh element is here like a some array of zero okay by the way this is an index zero okay okay i'm writing okay let's make it a rr okay not a rmn okay a rr only okay and there is some

uh addresses there okay we have some address okay some thousand addresses there then we have an offset value okay so that's why it's starting from the zero value okay if you want to store array of one okay uh it's go to another array which is 1004 okay why i have written the 1004 can anyone tell so this is a base address and size of the each element okay four byte okay i'm taking yeah integer is a four byte that's why i'm taking as a array of a uh like each element taking four byte so that's why like i'm taking thousand four okay area of one okay then area of simply two okay house and eight uh sorry this will be one area of three okay this will go to the thousand twelve and then this will be three okay so how it is calculated so how address is calculated like how i'm calculating your base address value so which is like a uh here like a thousand okay and then i'm taking one index okay index value cross

with the cross value cross your size of so this is how calculated okay uh if you want to take one example if you want to visualize it then it is goes like this my base value is like this cross four four four byte each integer okay we are getting thousand okay so like that if you will play place like a one here okay like offset value so let me also tell you this is address okay if you confuse letter this is offset okay so yeah this is where you can imagine something like and this is uh element okay this is not a poor class but i'm giving them some extra information so that you can see like how array is storing underneath and why it is called a zero index okay so that's why like if you want to take another example as two plus four so it's eight okay hope you got like a uh why the array is storing in this manner okay so yeah why not start from one like you can you can absolutely can design the language that starts from array starts array from the one but some

programming languages or the system use one indexing also like but zero indexing fit very naturally with the idea of a offsets and make the calculation simpler so that's why okay good uh we see like a what is an error and um how it is stored uh let's go to having some curve okay uh let's solve that problem okay okay coding guys solve the problem okay right we'll we'll see okay what's the question is first of all i cannot able to access my screen actually yeah so first of all uh you're given one array of integers okay so your task is to determine the minimum and the maximum element in the array and the input format input format will be like the first line contains the integer n which defines the number of element in the array okay how many numbers are there total in the array that defines by n okay and the second line contains the n space separated integers representing element of the array okay so if

we will see the example so first number is like a representing the how many numbers are there in the array second is n space separated okay actually if you want to troll you can troll this is not separated by space but yeah this is space separated okay what is that so this is space separated and space separated you can see the array okay so representing elements in the array now the constraint is like a n is between the one to one six uh one lakh values okay maybe okay you can take and array elements integers in the range to minus 10 to the 9 to the 10 to the 9 in that array you can take now you have to print okay output format will be print two integers separated by space okay and the minimum element in the array the first one is the minimum element in the array the second one is the maximum element in the array okay you just have to find you can you can think of like if you if you're seeing like this one is the minimum element this one is the maximum element

so you have to think like how you can get to this point so that you can able to find okay you can maybe like you can do the linear search you can do the binary search okay you can do anything okay you just have to find okay i know it's not very easy to like who is uh who is from the non-coding background okay but what will dry run each and everything so that you can understand and disclaimer is like a uh you may get bored both coding and non-coding okay while dry run okay but i'll get get you through that dryer also okay okay so let's solve the question Why this is a problem? Yes. Let me minimize. So, yeah, now it's good. So, first problem it's telling like we have given the n equals number of elements okay and the second line is error equals to an integers okay correct and we need to find the maximum element and minimum element okay you have given one error let's say I'm taking first example one two three

four five okay and then you have a answer will be like a minimum equals to one maximum i i don't know everyone is joining now equals to five okay now let's do the programming okay so in a python so first of all you have to take the number okay as an input okay in the array so how you will take that okay suppose uh there is an uh static value how you will take like this you just have to define n okay or like any variable name okay like this and you can take an array or you can take n as n okay you just have to as i told like a square braces will be there okay and you can take one two three four five right but if the user want to take some other elements okay you don't have to come hey shatish come here and change these values okay i want this now another user will come okay come so this change these values okay hey we can do like this okay so that's why we have some user input in the python right so we will use that so how you will take so first of all some taking some value from the user

we use input function in the python okay like input off okay so this input is sufficient no this is not as sufficient okay so that's why what it will do what is the meaning of this okay it it will take it will take the string values only string values only okay but we want the numbers okay now we don't want any strings right hope you understand strings right not that uh strings means not that kite thread okay or like any thread i'm talking about okay strings means like a hope hi okay if you are telling like i'm giving you an example okay hi how are you okay so if you're writing the sentence or a character okay anything like it will consider as the strings okay strings value okay this is a small example okay so um we have to convert into a integer value okay what we have to do then we have to add int of okay when we will add int of then it will convert the strings into the integer okay so we just have to add like this okay

like this then it will convert whatever you write okay okay so one doubt you will be like a hey if i will write this if i will take the uh strings value then what will it will happen okay suppose uh now compiler compiles okay it will give you a type error okay it will say like it integer is expected expected but string came from my fault okay so it will give you an error okay if you will even put the strings okay correct uh you will you will type one array okay you will you were you are taking one array how you will write i'm i'm writing then i will uh let you understand okay what i'm writing input of okay split okay okay what i have written okay as it mentioned okay first number it will take the number of elements i have taken the number of elements let's say my number is five okay i have taken that then i am taking the array okay how i am taking i am first of all taking input then i am splitting

spitting by space okay then i'm mapping okay what it will do okay what it will do if you if you take in one input one okay then it will put the space okay then it will do the map function map of okay map of one what integer value so we see input function is a by default string value okay so whatever it takes even it takes one okay it will take as a one as a string now what we have to do we have to map okay why i am writing the map i will tell you in the end okay uh we have to map okay map it int to string value okay int we have to map like this okay now this one is a int value okay we are telling like that okay we are mapping the values uh we are mapping the values to the data types okay like that you can you can imagine okay so let me also tell you like if you cannot able to understand what are the data types are there there are four data types in float full string okay there are four data types so these are these are some of the examples okay

15.0 okay two okay hi or hola okay something like that okay or something if changes comes okay funny follows my brother okay so this is interesting okay uh uh so uh map okay so we are mapping one one value to the data tag okay now we have mapped correct means when the number will become here okay when the number will become it will map to the end okay something like that uh then in then if you if you are taking some input two okay then if you are taking some input three it will map like that okay then what we are doing we are list okay so in a python how we are making error like you can take the function like either list of okay or either you can take the that brushes okay as i've taken here okay as i've taken here okay so like that you can do okay now what we will do we have to find minimum and the maximum value right that's it so for the minimum value i am taking one functions to store that minimum value later on we can show okay so that's why okay so that's why i'm taking some minimum

value i will store as a array of zero okay i can take any value of a minimum okay okay you can take any value as a minimum value you can take any value as a maximum value if you want to choice like a my minimum and the maximum value will be same that is also fine you can take okay i'm taking like that array of uh zero okay maximum value okay now uh now what we will do how we can defined like a anyone is asking for questions or like what's true okay so pure class is silent right so we will use for function okay for loop okay let's have find category how you will find the numbers okay you will go through one by one right let's say one two three four five okay so uh you will go through one by one okay how you will go okay if you will see if you are a human how you will see okay you you will first go to the one element okay if you will see oh first element is my one okay i will compare it to minimum value if it is a minimum

then i will store it in a minimum okay i will compare again it to the maximum value if it is maximum then i will store it into a maximum value like that you will see okay you will go to one function let's say uh you will go to the i i here then uh i'm taking variable okay i plus one here okay you will go one by one and you will compare each and every value and you you will store it right so like that we will do also so for i in a range okay to 1 comma n okay 1 comma n okay what does it mean okay so we are taking one for loop okay hope you will see the for loop like this if you are coming from any other background okay i will write like this okay so what does it mean let's say we have a list or any list kind of array is there or any list is there we want to iterate something okay we want to iterate through the list okay so that's why we are using for loop for this okay we have a for loop in every programming

language for this okay so that's why we are writing for loop to iterate through our array list okay hope you got it okay now what is the range uh so now what is the i i i i taken the i value here okay so how you will map each and every value through the i okay so i is here to help to map your 1 2 3 4 5 okay to understand the value okay so that's why i is here okay what is the range value uh sorry what does it the range means okay so range is like a you are taking how much okay how much you are taking the range okay we we can take uh that's why we are taking n okay so n means like a 5 it will go up to the 5 no not like that it will go up to the n minus 1 so range is a predefined function of a python okay which is already written predefinedly which will take your values up to n minus one okay or like a yeah n minus one only so then we will write if array of i if you are seeing like a array of i is less than minimum value then you store better

that i you store better that i into the minimum update the value okay first we are storing the array of zero something okay means we are storing the first index okay first value okay now we are storing the updated value why we are storing because we have found that oh something there is a value which is a minimum then our current value which is already stored which is array of zero now we are updating with the array of i because this is a minimum value what we have get so far okay uh now for the maximum value if the area of is the maximum okay yeah maximum then please store the area of i now print both okay there we have a print function to print everything like anything you put if you want to print in the console or in the terminal if you want to see there is a print function in the python okay which you can use for the printing the values okay i want to print what i want to print only the maximum value and the minimum value

so minimum and the maximum okay that's it okay now if you will run this program how it will run you know okay oh okay so let's take one example okay let's take one complex example okay uh hope like a everybody can understand okay so i'm taking an as an array okay minus three zero seven who is vikram singh here like he is asking for the permission till half an hour okay so let's see uh yeah minus three zero seven uh let's see minus two okay nine and four okay now according to the so internally uh it will take the array as i told this function will be called okay we have already taken the input as a six now we are taking the values okay these values okay i will simply copy this i'll paste it here okay so this will come as a comma separated now you know you can imagine the index like a zero because i am intentionally indicating the indexes okay later on i will tell value y okay now let's say according to my program okay i have taken the array of zero okay which is

which is minus three okay i'm taking again the array of zero value which is minus 3 okay now i'll try again okay my this function will be called i'm better i'm copying this i'm testing it here so that you can map in your mind now n equals to 6 right so n is here 6 correct if you see n is here 6 and then my range function okay my range function will be put as a six which produces which will run up to one two three four five one two three four five okay up to five times it will run why it will run five times because rain is a range is a function if you will define whatever the last function okay it will run as a minus one times okay so let's say can we define only one number here okay yeah you can define one number here six what will happen it will run for the five times only correct why i am intentionally defining the one here because i take in the array of zero here that's why i am defining the one here because

i do not want to compare the same value with the same value right i want to compare the values with the other values so that's why i'm taking the 1 here so when i'm taking the 0 okay so minus 3 i'm taking the 1 here so that i can compare the 1th value okay 1th index value with my minus 3 value so that's why i'm taking the 1 here here okay hope you got it so now i will be come here okay so now i equals to 1 okay now area of i okay which is area of 1 which is 0 okay oh it is 0 yeah if you uh if you're getting confused i can again copy here you can map okay area of 1 now minimum value now current value will be what minus 3 maximum minus 3 okay i'm writing in a sort max okay now the current index is current value is 0 okay so now it will compare the if block okay if area of i what i have written area of i less than the minimum value okay which is equals to 0 is less than minus 3 okay this means false right so underneath what happen it will like it give you the boolean value only okay

if is comparing in a boolean only okay so if whatever if is taking if is a predefined function by the way okay if is taking in a boolean value okay so this is a false right so i'll get out of the loop sorry out out of the if block okay so it will get out of the if block because it is a false okay now it will go to the second if block okay i am written here okay the second if because it is a false so now it will go to the this statement okay now it will come here okay it will again check oh if it is not a less than okay is it a greater than okay yeah it will tell like yeah it is a greater than zero is which means true okay so if it is a true then execute the command okay execute the command so what is the command so max equals to area of a i so you just need to store the maximum value which is already there you just need to update those values okay with the area of i so what is our area of i current index which is zero right correct

now end of a iteration one why it is end of because we don't have any uh we don't have any condition right so i am writing this print function out of this for loop okay this will not come under this okay out of this so we don't have any conditions okay further so that's why the first loop is the first iteration is completed okay now what will happen it will go to second iteration so first iteration is complete okay now it will go to the second iteration okay in the second iteration i equals to 2 what is my i equals to 2 i equals to 2 is my 7 okay so now it will compare again okay now uh okay 7 is less than the minimum okay what is my minimum it is minus 3 okay minus 3 because i didn't change the minimum value i lastly changed the maximum value right so minimum value was as it is there okay so is it a minimum no is it not a it is not a minimum so again it will come as a false it will go to the maximum value it will

go to the again okay iteration like that okay close then so after the i equals to 5 it will come as a maximum value is this and the minimum value is this okay it will come and the print okay hope you guys understand my point what about the first name and the last name bro it is not there in a even in a question what you're asking mohamad so what the heck bro my bro is asked which is not there even in a question nice okay it's clear right anyone is having any doubt okay so it's already 12 okay it shouldn't be hey everybody clear the like a question right how how to write like i can take the hand system so resneet is first okay what the heck there are 10 hands but but we'll start okay so guys anyone is not complete the questions okay i'll give you the algorithm by the way okay i'll give you this whole point okay into the the hack i think i lost so i'll paste it here okay you can take this okay and you can complete the question okay

we'll start the next question 12 15 okay but for the cs guys i know this question shouldn't have taken this much of time i've taken because of hope you can understand for the other folks also okay so yeah so i'll take the doubt session okay okay rajneet is first rajneet i'm allowing your mic you can ask yeah go ahead so okay rajneet is not able to speak okay no issues uh second is monica okay hey hi monica you have any doubt okay she is also having not having any doubt uh mayank hi mayank sarat hi sir yeah hi thank you for listening to my class yeah sir you explain the algorithm very well all that that is the algorithm that is a very like kind of basic but i have a different doubt actually while creating the account in hacker rank sir we got to know that it's for mtech and i am an mca student so is there any different lab session or different hacker rank account for mca or we'll go with the mtech one uh no bro like a hacker rank will

won't difference like a human uh we are doing in a earth okay so it will take as a same only No, I am asking about that. No, no, no. You can name it as a, like, okay. What you can do? Like, you can name it as, like, your role number. Okay. Just like that. Yeah, correct. Why I am taking, like, why I am saying like that? Because I want to, like, evaluate in the later on. Okay. It's easier for me to evaluate. Okay. Who can ever submit it to those submissions? Okay. So that's why I am telling, like, you can, I can take in for your role number and then name if if i can be able to find you okay so that's why i'm telling yeah sure thank you so much yeah thanks mine uh robin singh hey hi robin i think robin is not having a doubt no issues hey purple do you have any doubt what the heck plenty people in a row about how the system import system i used ai to find the solution for this question and that is one great system kind of thing but your view of using this for loop kind of thing is very simple

and fantastic again fast also yeah also i want to understand what is the main thing it's in every program yeah yeah i didn't retain the for loop can i paste that yeah yeah yeah half of your like a voice is cannot able to audible but i can able to understand your question uh you can you can paste the solution here like i can able to understand what you may try to say okay give me a second yeah sure Meanwhile, I'm taking the, another doubt. Okay. Hi Krishna, Krishna Chandra Arora. Do you have any doubts? Uh, actually I'm not having a doubt. I'm just, uh, like trying to like clear it for me that, uh, I'm already working as a, uh, working as a senior software engineer for the last seven years, so, and most of the time we are using C-Sharp and Java as the language. Uh, and sometimes we are using C++ because the application on which we are working is basically the enterprise enterprise level application. So there's a mix of all the languages into it and the front end and the back end is written on the same languages.

So my question is basically that I'm trying to solve these questions using C sharp, C++ and the Java, but I do not have that much of knowledge about the Python language. So in the latter stage, I have taken cloud computing. computing oh nice so uh and uh and those who are and i just one suggestion being a being a uh being a uh experienced uh i think most of the people who are working uh who are who have taken this course they might be there from the working professionals so they are having some background in the coding also but uh in the enterprise level when we are working and we are using the cloud code as a subscribe like the subscription we are having the company has provided the subscription for that yeah but clause cloud code actually has hallucinates a lot like even if you're going for the enterprise edition and enterprise application if you're trying to find the or trying to debug the like a flow of the code and if you want to like find out that where you have to make the

changes in the application there it hallucinates too much so your basic knowledge is very much required into it just to be sure that whatever the changes it just suggests you that would work with your uh with your application so those who are trying to solve the question in the latter stage they will have to have a very very good in like in uh knowledge about the coding so there's no use of like using the uh ai while solving the questions so better if you have a good knowledge that's my suggestion and my question is basically that in the latter stage uh if i switch to python instead of just doing it right now whether that would be a good idea like right now i'm just trying to solve the question but in the latter stage sidewise i will just try to like find the syntax that how i can solve the same questions using the python language or i should try you using the python just from the first question itself what's your question

you can solve you can solve using python there is no any issue okay yeah okay but right now i'm just solving the question using the java language so is it okay yeah yeah yeah it's it's great not okay okay thank you sir yeah thank you Krishna Saurav Pandey hey man it's 12.14 already 12.15 we are going to start so this is the last hands up I am taking okay there's 20 okay most of the people hand raised but don't have any Karsha Sarma hey do you have any genuine doubt uh like hi utkars have any doubt hello sir sir actually i just wanted to ask that i just really feels like a lot of fomo out of here because i have actually zero knowledge about coding so okay like can you can you just uh for once like uh solve it or show us the solution for this problem on the hack rank page oh yeah sure but i'll solve the next question okay so when you joined the class sir i was following you since the starting but uh i also got the

problem i also got that algorithm and all but i just don't feel like that i would be able to solve it or not it's just an english language you know python is just an english language there is nothing just there is no any rocket science in that but you can able to understand like if you i already pasted the solution in the chat you will see okay if you if you can see this just find the minimum and the maximum element okay if we will go through the solution you can easily able to understand if you cannot able to then we can solve okay in the later in the class okay thank you thank you sir thank you hey hi Ayusha do you have any questions generally yeah hi so I actually had a particular question related to the UI when you open first the page it showed that there are a few challenges on the other hand i didn't see anything i just saw some contest questions and just two of them were the one that i saw in which one of them was the

maximum and the minimum one which i'll be solving yeah yeah but these are the questions only yeah i'm getting these questions but it's not the same ui like it's not the same one like you no it's not an issue like a you can see like a maybe i like a half the screen i i did the half the screen that's why i'm getting this view but this is the same question you are getting right the question is saying the input format is saying the out yeah that's the yeah that's okay yeah thank you actually okay uh rest i've taken the 10 questions okay like a later 10 i'll take in the uh i'll take the last okay yeah thank you folks but uh let's go to immediately to the second questions what the heck who is this um who this is i told you the oh sorry i didn't mute your mic okay okay yeah yeah sorry where are you by the way i have to read you can just tell me about this function kind of thing how function works in python yes okay okay can you paste one more time uh yeah

if you can paste one more time yeah yeah you pasted my questions only no no this is costo what is the purpose of a map function okay is it converting string to int yes it should be implicit conversion so okay we'll we'll take the robin question also crazy bro it's written it it didn't even return the okay so what happened properly okay it taken the predefined the minimum predefined minimum and the maximum function okay so there is a min of and max of like i have showed you the int of okay it is a converting the integer value to the integer value okay like that it will there is a min and the max predefined function it will take your array element okay as an input and it will output your minimum value and the maximum value. Okay. So, okay. So, you can take a look at my function. It's very easy to understand rather than looking at the AI solution. It didn't even return the for loop. Okay. That's why I asked Prabhul.

Okay. There is no issues. Okay. Just look at my solution. That's it. Okay. Okay, sir. Thank you. Thank you, Prabhul. Thanks. okay so let's go to the second question array hunt 2 okay I went in know what is this function okay so you are given an integer array and the target value okay okay there is an target value your task is to perform a linear search on the array to find the target value the linear search means the scanning each element one by one from left to right okay input format will be the first line contains an integer n which defines the number of elements in the array the second line contains the n space separated integers the elements in the array okay what are the elements is there the third line contains the integer x which is a target value to search for okay again the constant is same okay and the output format will be print a single integer that define the index zero uh based okay so we will go go in a zero based index okay of the first occurrence of the x in the array if

it exists okay if it is not exist then we have to print just minus one okay if it is exist then we have to just print the index of it x value okay so let's say in the example of a input zero we first number is defining the how many numbers are there in the array which is a five because two four six eight ten which is five numbers then second is a defining the what are the elements in the array okay which is a two four six eight ten third element is the target value from the array it may be from the array it may be from the out of the array okay it's depend on the user okay use cases also uh we have taken simply like a eight okay so eight is a which indexed we have found three index how how we know that because zero one okay so two is a zero four is a one six is a two eight is a three okay so that's how we have find eight is coming under third base index okay so that's why we have print eight uh sorry three so in explanation zero okay so sorry

another example okay we have taken the six elements which is one three five seven nine eleven okay that's why here six is that the target value is a four which is not there even in an array okay that's why we have print minus one so that's what you have to do okay so how we will find okay so let's go to the solution okay let's see hey what happened my screen is stopped one second just a second guys i don't know what happened yeah sorry so we will write the solution okay so our job is to search for the x from the left to write we have given one error i'm taking first for example 8 10 and the target value is which is which was 8 as i remember uh so as a as a human how we will check we will go through one by one uh which is two is it is it eight your mind will say no it's not an eight okay we will go to another function is it eight okay so first of all i am solving in like a dry run situation okay so i'm going in a human human manner okay i'm looking at the question okay i'm solving it

okay there's no need to fear like a i'm going to the second element okay which is four okay so i'm asking like it to the mind okay is it eight okay my mind says no it's not an eight okay you have to go to next okay then is it eight okay it's saying you know it's not an eight is it eight yes it's a name then please return which index it is so this is zero this is one because we are going in a zero base index okay it is three okay so we have to return and hey that's it okay we have to do like this only okay who asked the question uh as i can remember utkars i think yeah utkars please concentrate in this okay if you cannot able to understand okay so first of all i'm taking as an input and why we have to take the how many element we have to take in the array that's why we have to take n okay how how we are taking the integer values you have to type int input of okay then next okay we have to take one array variable which is equals to list of okay uh i

think ravine singh asked the question why we have to map okay please concentrate in this okay input of okay dot split okay again i'm repeating how it is working robin see the question okay see the see the function okay so map function means you are mapping something okay do something okay don't look at anything don't look at like uh as a value or integer okay something okay so we are mapping something into something okay so we are mapping something data type into something okay it may be a string it may be a like a it may be integer okay it may be a float value okay so you are mapping okay so that's why we are writing map int of okay so means we are taking one data type which is the int we are mapping the input value whatever we are importing okay through the like a input function we are mapping into integer value okay so why because input function takes in a string value okay input function takes in a string value so we cannot able

to uh go through okay while we are looping okay so what happened uh why can't we process like a for loop in a strings okay we can able to process but it will not counted as a okay so can you compare the string is less than the minimum value no you cannot able to compare right you can able to compare only with the numbers value okay that's why we are converting strings into the number hope you got understand robinson okay so that's why we are mapping like this okay map of int to something value okay so i'm writing then i'm taking my i'm taking my x value which is my target value okay again how i will take int input of okay so i will again write this for a robin okay like this is a string i'm taking i'm converting into a integer value okay then i will write for i in a range okay and okay so why i'm not taking any any uh sort of things like a one command one comma or two command okay because we do not have to like a uh compare okay we can

we can compare like that also okay we do not have like a minimum or a maximum kind of things like a logic so i'm taking as a simple n okay n means how many values are there here five values okay it will run as a four times four times it will run okay why my n is my n is five okay my n is 5 i'm taking the value as a 2 4 6 8 and my target value is like a 8 okay it will run as a four times okay because uh range function is itself like a uh n minus uh times it will run okay and main thing in the python is like you have to intend okay whatever you are writing you have to intent in a very manner what what do i mean by intent you cannot able to write if here okay you have to tab okay you just have to put the tab button in your keyboard okay wherever the wherever the wherever the if block comes okay there you have to start start from your language okay then if my area of i is okay i'm writing in this manner only okay is this equals to okay no

equals to equals to okay x okay so why i type the double equal okay to the compare okay what happen i will write single equal i am assigning okay i am assigning my x to this value okay okay so that's why we have to whenever we have to compare with one value with the another we have to write double equals two okay right then we have to write the print of i okay then we have to write a break function okay i will tell like why the break is there else okay print minus one that's it so if you want to see the dry run of this okay so first of all this for loop will call for i in a range of five okay n is my current currently is a five okay range of five minutes like it will run up to the four four time huh like i have defined here okay you don't have any questions of this like i have defined here the first value okay if only range is there okay then how it will take the first value from the zero or one okay it will

take always from the zero okay zero th index only it will take the value always from the zero okay and it will go up to the n minus one it is designed for only list okay the range okay then i is assigned as a zero okay and then it will go to the one two three four five okay like that iteration okay if then it will compare with the if okay if area of i equals to equals to x okay it's a it's a simpler like you can understand array of current value is what area of zero okay array of 0 means what if you will take the example of a 2 4 6 8 10 sorry 6 8 10 array of 0 will be this one 5 0 1 2 b 4 okay so array of 0 will be my 2 okay sorry 2 equals to equals to what is my x value x value is like a i defined 8 okay it will compare again okay if it is this okay no this is not this okay then it will again go to the for loop okay it will again go to the for loop okay it will compare again uh because this is uh coming as

false right correct so it will break okay now you understand why i have written the break value okay if i will comment out this okay let's say i will uh in the python if you want to write any comment sort of things okay what do i mean by comment even so let's say you written this program okay if you want to write or let other developers know that what you have written here you can simply right so this is a program where you can find target value okay from arr okay array correct so this is kind of a comment okay so i have commented here means this block will not work okay this will not work in a this will not even execute okay this will count it as a comment only so i commented it what will happen this condition will fail okay when two will come then it will again go to the else block again it will print the minus one every iteration i go through it will print minus one minus one minus one and then it will print the three okay like

that what what will happen i'll tell you okay if i'm not writing this okay break block if it will print minus one minus one minus one then it will print three okay then what again it will go and will again print minus one like that it will print why because when you don't break okay you you are not telling your if block is break from here okay it will again go to the another condition okay to check like if it is like a uh there or not okay do something like that it will do okay uh uh two or two is not satisfying eight then it will go to the again to the four block okay and it will go to the eight okay check then break okay then it will go to the check it will break okay again it will come to the 8 okay it should come to the 8 okay then i will print the print the index i index i okay i'm printing only i okay not array of i array of i if i will write then i'm indicating the number okay not the index value okay that's why so for the index value we need only i so i

am defining index i so it will define three that's it so this is how this will work okay hope you can unable to understand now i will better i copy this link also okay kotlin link so that you can able to get all of the things okay what i have explained here what did i give to you okay thank you so much for like a not spamming okay uh where are the other tens okay hey gc sama i think gyan hi do you have any doubt i have already unmuted my mic we have sufficient number of times like a 30 minutes for the like a doubt sessions okay you can ask any any any of the doubt like a any out of the box also considering you are in a under recording okay you don't have any doubt i think so jc sarma okay no issues you are already unmute just click on your mic and speak with me that is also I have to save the screen I have to tell like how to do it or like maybe you are like a kind of lack of internet so that's why maybe

I will come back to you Shraddha Khamat you are in a any relation between Nikhil Kamath? No, no, I get asked that often, but no, maybe like far, far cousin or relation like far, far cousin or something because all companies are related in some way but no, nothing direct. Yeah, but my question was so in hacker rank, one of my test cases failed and then someone on the chat helped me out, we fixed it, but next time if this happens, how do we submit it, like? No, next time it will not happen like a I don't think so because it's already taken your account so I don't think so next time it will happen no no as in next time when there's another assignment to be submitted and then one of the test cases it fails then and let's say I'm listening to a recordings then how do I submit the solution for it so will it be considered as a valid yeah yeah okay okay let me tell you also like I forgot thank you for remembering okay so

guys if i will show you another thing okay so whatever you are submitting okay so you have the time uh hope you can see my screen okay yeah yeah so hope you can see like i am giving you one week of a time which is starting from 11 okay which is your class time although okay i'm giving you for the submission like it 23 which is a exact like a uh it will like a end of your time okay uh you have to submit in this duration so that i can able to see don't think that i cannot able to see because i already seen like how many login count is there okay how much signup count is there and whoever it is submission so like a view contact submission whoever it is submitted okay what are the results are there hope you can see like a i cannot be too hope you can see here okay yeah so all the things i can see like whoever like submitted what okay how many test cases passed what is the leaderboard okay so all the things

i can able to see so got it please got it but let's say one of our test cases fails like one of it but like one out of seven cases fail and then we submit it is it considered a valid submission it is considered but better you you because if you're coming from the like a coding background test case we cannot able to show you okay first of all and you have to think in in that manner what is the edge cases are missing so that you can able to find out so in any case like if you are considering like a 50 percent of the test case will be passed above yeah okay yeah then it will be as a considered okay okay got it and these are considered for the final grading these assignments yeah yeah okay got it thanks thank you surda sorrow kumar pande i have i've taken to my i don't think so yeah last time you missed hi sorrow i had it yeah basically my question is that uh on the second example you have shown that there is a break the statement

right yeah while printing so that's fine but uh my question goes to the first one that if there something that is break that can like miss the loop whether can't we not have something in the finding maximum or minimum because once we find the minimum that number can't be maximum so is there anything like we can use break here or something else that could do the same why you need to break over here like let's say let's say i use the break even though here okay okay so i i let's say break over here it will break the loop okay it will break okay and again it will go to the another iteration will not go to the this condition event okay we want to check like if it is a maximum or a minimum each and every value we have to check okay yeah but but my question is but my question is if a number is minimum it can't be maximum right maybe maybe for the other upcoming numbers it may be the maximum who can who can say no no i was just

telling like if we check the condition and if the number comes out to be minimum then it is sure that that number can't be in the maximum yeah brother like a what i'm telling is like a let's say but for the particular time it is a minimum okay maybe for the upcoming numbers okay it may be the maximum who knows yeah yeah so so that's why we're comparing each and every element right we have to compare like that okay so but uh the thing yeah but the thing is that if it comes out to be minimum so that next for and if condition would also run right to check whether the same number is maximum yeah so that is what i am asking is there any sort of a statement that could just skip that and like go to the next iteration suppose we are in i equal to zero or one so if the number one comes out to be minimum so uh we don't check the if condition for the maximum and go to the next index this is a simple simpler like i cannot able to understand like what you're trying to say

but why you need to skip the element you need to check right you need to check each and every i'll just redefine my uh doubt uh it is like suppose we are in index at i equal to one and the index i equal to one suppose comes out to be minimum so uh the and in the for loop you have another if condition to check whether the same number is maximum or not so that is what i'm asking that can is there any sort of a statement that could skip the second one if then the first condition becomes true i don't know i don't want to skip rather like i want to check each and every in the area i want to check like each and every element to the other another like upcoming elements if it is a minimum so then yeah so that's perfectly fine but i was just applying trying to combine those two concepts because if a number comes out to be minimum then no no no no don't skip yeah like you can use like a continue okay continue is there keyword is there okay you

can skip that but there is no use of that man okay okay so if we use continue in the first statement after the if like where you are checking minimum so i think will that produce the same result it will just skip the element and it will go to the uh like it it will skip one element okay it will skip the one element okay and it will go to the another element yeah so that element okay but if it is a minimum or a maximum how how we will know you will get the incorrect answer maybe in the result so the uh thing is that when you were assigning minimum equal to error of i and the next statement if we put continue so will that not produce the same result no it will not produce okay thank you that was only the doubt i had yeah thank you sarah you you're coming from like a cs background or like you're not coming uh probably i am not from cs background predominantly but i have been in this field from last one year so oh got it thank you

thank you okay hello the mic hey hi vijay kumar kirar you have the genuine doubt or like i don't think so visa is there which is left might be hey hi sachin pal sachin is also not there hey whenever i'm telling hi to your name right i already unmuted my mic maybe again hi sachin pal no okay no issues great uh hi dipika um hi sir can you hear me yeah i can hear you i just wanted to ask can i submit the code in c plus plus is python is mandatory yeah i already told right uh you can submit in a c plus plus you can submit in uh the available languages uh there in the compiler hope proceed okay okay thanks sir thank you huh hi uday banu kumar are you there no hi yes yes i am here okay so i am new i am actually i mean new to the this uh i mean poor okay so so can you just guide each step where should write the code and where should yeah sure why not why not hope you can able to see my screen yes yes i am able to see if you are comfortable in any any of the

language okay thanks god by language is not there okay uh sorry uh you have to choose like a python yeah okay five two yeah any any of the things okay so then you just need to uh this comment is there okay i just removed it okay then you just have to write your like a whatever things i have written there okay you just have to write then you have to just put the run code if it is runs then it is good if you are getting any error you have to debug it by yourself or any with the activity okay okay then you have to submit the code okay by submission if you will see sorry if you will see your all the test cases are passed then you can submit it oh okay okay okay okay what what is yeah thanks and one more thing actually i am from a csc background but i have left the job i mean the the programming code last 10 years back so could you suggest any uh suitable book for python to i mean just for the beginners uh

python books okay why you are going for the books can i suggest you some youtube videos yeah yeah any any any i mean link source where we can you go to better like a there is a video from uh whose name is that python uh i don't remember code code code code code yeah campus x okay so if you will go to the youtube okay you just find out the campus x python okay python video just go there and study that's campus campus x yeah campus x it's good bro oh okay thanks thanks yeah good for the health and mind okay thanks just looking here like uh hi om kumar singh i may not able to take the doubt but i can able to unmute you so om kumar singh is not there uh maybe who is there anand gupta hey hi anand gupta hi sir thank you and thanks for explaining in a detailed way i forgot the doubt actually i have a static but it cleared by the previous how how many the person there works. Okay, okay. Thank you, Anand. Thanks.

Lokanath Giri. Hey, hi, Lokanath. You're there? Lokanath is not there. Oh, you're there. Sorry. Hey, hi. I already... Yeah, you can speak. Hey, Lokanath. You was there, right? By the way, let me stop the recording. It's not a...

