 Alright guys, I am going to try this Amazon coding challenge and see if If they do well on it, let's do it. Maybe I should turn off the camera Here I'll turn off the camera. Oh, not this one. This one You have an array of strings logins where the lengths of all the strings are equal a string can be tripled by one to derive rotating strings on the left so one AVVC two strings logins are Called family logins if one of them can be transferred to another as an example strings BCD ABC our family log in because each Character in BCD is above care to ABC. Okay, so BCD ABC Is one above login, okay Find the number of pairs of IJs such which are family logins on that any pair of strings can be For a log in if the pair of condition to me at the array strings bag safe See a fairly pairs like one and three Okay bag and CBD CBH our logins in this. Okay. One two three One four is a log in one five as long We just need to find the pairs of logins plus one Bag XCB H. That's a log in S F E red. That's a log in. Okay Corn DPS O is a log in E okay, so if you okay, this is not that hard I'll just do brute force for now But they all the same length. Oh, the lengths are all equal. Okay, so that's good. Okay. Um, Let's just do we could just subtract each character from each other like convert the string to ASCII and Then if they're not equal to the previous one, we just say it's not possible. So this would just be false so Yeah, let's see convert string to in ASCII CC plus plus I think it's like minus Zero or something Why can't I do a log in? Yeah, okay. Okay Yeah, so we just take the first character subtract it So let's see diff is gonna equal to this and Then we just do the same thing and if this is not equal to the first character then Yeah, then it's just false Yeah, okay, so this would be zero this would be zero and And if this is not equal to diff equals true Paws equals to false break if boss is true. We're gonna just have a counter and do Count plus plus this should be over three, and I think it should work when you run the tests I might get TLE though, but I Have no idea output six expected three And let's look at test case zero two three Can open another ID? Yeah, I think I can fuck can't use my ID It sucks Man, that's really sucks. Okay, if I can't use my ID, I don't know. Let's see what what the problem is All right, the difference between here here is Should be absolute value of no fucking idea corn horn DPS. Oh, I don't need this Corn horn DPS. Oh DPS. Oh, should I print? It's just print It's possible. I should be ABS also Corn horn DPS. Oh, okay. Oh, you know what? This is a socks. Okay. I have 19 minutes. What the hell am I doing? You just output The I am the J where this is it fails Zero two Okay, so zero two zero two works. Why does your two work convert character to ASCII let's see convert. Oh, it's just integer. Okay. Let's get rid of this How's zero still wrong? Zero two zero three zero four. What is the problem? Okay. Wait, what is difference? Zero is not equal to one So it should be zero is not equal to one. It shouldn't add Let's see Pause should be false. It's so dumb. This is so dumb. I have 15 minutes. Okay Which is that what's the next problem? Yeah, I really don't give a shit about this This isn't a hard problem though actual diff is one Why is our diff one? No, wait, that doesn't make sense actual our difference is Zero actual diff is one Yes, okay, so if it's oh man my brain hurts. Okay, so zero one are these the same is No, no, so we should just break. Okay, so if it's not possible, we just break. I don't think I'll be able to figure this Okay, um CBU BAT is one and two true. Oh It is. Oh, they have to be greater than one Damn, let's see. What is the problem? Okay, so if they're not so only do this if I j is equal to so okay If Okay, we're good for them pass now we have an hour left. This is fucking ridiculous I'm only get the first be able to solve the first one Coin DPSO coin EQ TP DPSO EQ TP. Oh I'm counting twice. Fuck. Okay We use a set and just add those values Into it and then just like return the size of that in the end we return occurred outsize I Think it should work Maybe it's not this. Okay. Hold up. They're submitted for now. I don't like this one's hard either. Okay, both of these aren't that hard. I Just I don't know if I have time to just debug this though It's just an implementation issue. Let's see if this works. Oh, that works. I got more test cases to pass SDFE SFE or ED Basically the difference of each of the characters must be equal to each other if they're not then it should be false And I think I did that this minus that yeah, this should work Is it absolute value? That's a problem. I'm pretty sure it's not there's need to be one or ABC ACD. Oh difference has to be greater than zero here if a check if our diff is greater than zero and If is greater than zero, I have no idea. This is I Couldn't probably debug this as it's in visual studio. The problem is that fuck it. I'll go to the next problem I'll go to the next problem Yeah, then piles of products the number of products in each pile represent a random product select a sub array from there. What does that mean? Select a sub array and pick up the products from that sub array such that the number of pop products you pick from the ice Pile is strictly less than the number of products you pick from the I plus one pile. Okay, so choose a sub array one four five Which is 12 products each of these? And pick products three four five. Okay, one two three two three Seven four five. Oh wait three four. What what do you get three from? Choose sub array from indices one to three zero one two three five four five two Why would it be three? I'm gonna guess you meant seven here. Oh wait indices one to three. Okay, so seven four five So we need to pick products from each of the indices which wait Select a sub array from a number of products and pick up products with a sub or such as the product number of products You pick from the ith pile is strictly less than the number of products you pick from the I plus one pile for all indices So I pick one three that's seven four five three four five two six Smaller than you could do it, right? I don't understand. What the hell are you talking about? One two three four five six seven one two three four. Okay Pick sub array one the three One two three Three four five what three four five what why is the maximum of products twelve? Three oh three plus four plus five. Okay It's only a problem. We are forced to pick only one product for index three isn't it? True sub array index one one pick all seven products. What is the size of the sub array? What do they want? Fuck man. I really can't I can't do this Hmm true sub array from one one pick all seven products They're actually understand One two Okay, okay. I think I understand what they mean. I code this Time though. Okay, um Two three four five Five two well I have enough time. Oh fuck. Okay um choose sub array indexes one to two from and Pick products two and nine or so quickly from each index which is 11. Okay. I think I'll Have to force this Okay, um We just have to check if if products that J is greater than I Plus one products of J minus one I plus one then we just add by yeah, so it products Oh, yeah, so products minus products at J minus one It's greater than equal to it is greater than one J minus one plus one. Yeah So nine minus two seven we can't do that. So we just do three Two plus three plus four. I think we could just create another ray. So we could just do like reset I don't know if products at I is greater than or equal Fuck this test case doesn't work Choose array indices one if I pick price one two three four five, which is 15 Pick products two three four seven, which is 16 products two three four One two three four five. So there would be too many edge cases one two three four five Two plus three plus four plus five. What is that two plus two plus four plus five? 14 one plus two plus three plus four plus five 15 In what scenario would this not work? Let's say you had two and nine Maximum this would be like maximum sum of sub array or something. I have no idea. Let's just okay. Let's just try Increasing sub array some maximum increasing sub array some I shouldn't be able to figure out the first one though be see a Just debugging actually sucks if it's not equal to the first one We could also have a previous difference Still no Wait, do they have to be only one? Oh, they have to be one wait. Okay, so we don't need previous death Still now oh what the fuck? Okay, I think that didn't do anything. I got a last now When they say family, what do they mean by that one step one time by rotating these characters right by one step Oh, oh my god, Z has to go back to a oh Man, that's so fucking dumb That's really dumb. Okay, so if it was Z I have to mod it by like 26 or something. I'm still not working. I honestly don't know Pretty sure you have to mod it then. Oh, man Feelings is not a hard problem. I just don't want it to bug or I just can't oh wait I don't have to do all the subtraction. Wait, fuck it. Okay. I'll be right everything Actually, yeah, I think I'll just read everything Fuck 20 minutes left. Let's try something real quick. It should be so much easier in visual studio My god, it's like plus 97 Cast us into an integer. Oh my god. Okay. How do I add? Convert Character to ask. Oh my god. Okay. What is what is this for at ASCII? And C plus ASCII table, okay, we have a which is 97. Oh, we just be this one plus one DPSO BCD. Yeah, yeah And then we have to mod it by Who was Z would be something like that else this Now we just have to count how many strings Or the same as just I have 18 minutes left. Fuck Okay, so this is Go on DPSO 3 would be QTP What the fuck I was it. Oh now this is easy count plus equal Counts at the Yay, holy shit. That's fucking amazing. Man. I solved the first one All right, this one is again. I don't know if I could solve the second one in In 15 minutes I'm gonna try in my opinion. It might just be like Oh wait, it's probably okay. This is probably a two-point right close disabled. I don't think this problem is that hard I just don't okay. If it was like Two plus three plus four would be two plus three four No, it'd be one plus two. Yeah one two plus three plus four two plus four plus five No, three plus four Three plus four plus five Isn't that just taking seven plus five though alone plus two isn't that 13? Oh, which is 11? Godly this is hard I'm not okay. This is not hard to do. I just I can't debug this in time. I use four Four I could do two plus two plus four No, three plus four five Loop from J minus one down to zero J plus equal to I whatever no, but that wouldn't work for one two three four five. This would be One plus two plus six. Yeah, that wouldn't work Okay, I could definitely figure this out. I just didn't have time. I think you just have to use sliding window like if this plus that It was greater do four plus three plus two J minus I three Times two times, you know, wait, you know, would that work? I don't know. Okay Whatever I could definitely figure out this this at this part Wait, I might be able to figure it out three plus four Three plus four plus five. Okay. Let's let's see if we can do this really fast Yeah, it's too late. Fuck it It's too late. I don't think I'll be able to answer it. All right. Well, this is a good challenge Hope you guys enjoy this video. I'll just submit it. Great. I'm subscribe. I'll check you guys later. Please