Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,209,549 members, 8,006,430 topics. Date: Tuesday, 19 November 2024 at 03:43 AM |
Nairaland Forum / Science/Technology / Programming / Can You Explain This My Hackerrank Solution For Me? Please(pics) (456 Views)
Solve The Fizz - Buzz Hackerrank Challenge In Both Java And Javascript / Can Some Explain This Hackerrank Question For Me please(pics) / Pls Explain This For Me (2) (3) (4)
(1) (Reply)
Can You Explain This My Hackerrank Solution For Me? Please(pics) by TastyFriedPussy: 9:56am On Nov 07, 2022 |
first picture is the problem second picture is my solution my solution passed, and I solved it all myself except for the second for loop part, which i had to copy from somewhere. i could not figure out how to make the array print out in reverse order. At first i tried of using swap(), a C++ function, and i never even thought that a loop could used to swap the arrar items, when i copied the for loop code, and it worked, i was like how on earth did this work? i thought i needed a specia function for swapping arrays and i started googling but nothing was working. so please, can someone explain to me how the for loop is swapping the array elements in reverse order. see picture below @qtguru (i know sey i don too dey disturb you but no vex ) honestly, I'm finding it a little hard to understand loops.. sometimes when i do things with loops, it always runs into an infinite loop 1 Share
|
Re: Can You Explain This My Hackerrank Solution For Me? Please(pics) by qtguru(m): 10:37am On Nov 07, 2022 |
Tip: Always pay attention to constraint N = Total Number of Array Length A[I] = A is Array and i the index in the array A[N] = Tail of the array A[0] = Head of Array Normal flow A[0],A[1]......................A[i] where i is the number Reverse Flow A[N], A[N-i]...............................................A[0] What it means is start at the tail to the head instead of the normal flow. Note: I don clock in, so I won't respond easily peace bro |
Re: Can You Explain This My Hackerrank Solution For Me? Please(pics) by qtguru(m): 11:51am On Nov 07, 2022 |
Update ? |
(1) (Reply)
Why Are Nigerians Accepting Low Pay In Tech? / What Can Cause A 403 Error While Scraping / Game App Developer Needed
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 7 |