Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,199,470 members, 7,971,706 topics. Date: Thursday, 10 October 2024 at 02:29 PM |
Nairaland Forum / Science/Technology / Programming / Technical Interview (383 Views)
I Just Bombed A Technical Interview / Job Application - Back End Software Engineer (node.js) with technical Exam / Python for Non-Technical people (2) (3) (4)
Technical Interview by LooneyLester: 6:54pm On Dec 31, 2023 |
Can you pass the Rockstar Games Job Interview?
|
Re: Technical Interview by Stephen0mozzy: 7:20pm On Dec 31, 2023 |
Thinking.... |
Re: Technical Interview by LikeAking: 9:50am On Jan 01 |
Very cheap |
Re: Technical Interview by Karleb(m): 12:49am On Feb 17 |
I may be wrong o but let me just tell you what I have seen so far. The second loop should run to i and not count. BitCount method is supposed to take in integer but in the usage, a boolean is being passed. It should be BitCount(intArray[i]) <= BitCount(intArray[j]). I also think in the BitCount, i should be decremented like so i-- outside the if statement in the while loop so it doesn't loop forever. I presume i>>=1 is the statement counting the bits, then it should be before the if statement and the count should be count += i. Anyway, type that to CHATGPT and see what it gives. |
Re: Technical Interview by airsaylongcome: 3:37am On Feb 17 |
Karleb: Output from CHATGPT Here's the corrected version of the code:
Changes made: 1. Corrected the bitwise OR (`|`) to a bitwise AND (`&`) in the `BitCount` function to properly count the number of set bits. 2. Fixed the missing curly braces and return statement in the `BitCount` function. 3. Fixed the loop conditions in the `SortIntsByBitCount` function to avoid going out of bounds and to properly compare elements. 4. Added missing parameter `intArray[j]` in the `BitCount` function call within the `SortIntsByBitCount` function. 5. Swapped elements correctly in the `SortIntsByBitCount` function when the number of set bits is different. |
Re: Technical Interview by Karleb(m): 8:01am On Feb 17 |
airsaylongcome: Thank you. See as I embarrass myself up there. It's important to run it and be sure it's giving the right result. CHATGPT solutions are sometimes wrong. |
(1) (Reply)
App Developer Is Urgently Needed / Netherlands What's App Number / .
(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. 95 |