Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,208,245 members, 8,002,015 topics. Date: Wednesday, 13 November 2024 at 09:02 PM

I Just Bombed A Technical Interview - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / I Just Bombed A Technical Interview (19761 Views)

Technical Interview / I Just Quit ALX Programme / Need A Technical Partner (web & App Developer) (2) (3) (4)

(1) (2) (3) (Reply) (Go Down)

I Just Bombed A Technical Interview by Deicide: 2:59pm On Feb 21, 2023
grin Too much pressure that i couldn't even think straight. The question is not even that hard simple data structure question that i can't even believe i bombed it. Chai.

I was asked to implement a Lottery system. that has the following functionality.


1. add_user(string: user)
2. remove_user(string: user)
3. pick_random_winner() -> string


Yes that was how easy it was but i bombed. Immediately i saw add and remove my mind immediately went to the king of all data structure HashMap grin but boy i was wrong a vector would do just fine, the problem here is the functionality to pick_random_user and the function signature. how do you do that with a HashMap if data are stored anywhere in memory? meanwhile in Array everything stored contiguously. But i was busy thinking of speed embarassed

In as much as hash map would be good for add and removal in 0(1) time. it's bad for random access.

could use HashSet but random would still Bleep you up.

My bad implementation.


struct Lottery {
map: HashMap<i32, String>,
}

impl Lottery {
// first problem realized here, what would be the key? and i don already talk say na hash map go good for this things o chai grin

fn add_user(&mut self, string: user){
// But this would not work it doesn't work that way. it would have made sense if the function has a signature for key.
self.map.insert(user); error, where is the key ? cry
}

fn remove_user(&mut self, string: user){
//no key can't remove anything tongue
}

fn pick_random_user(&self){
// impossible!!! no key no random - even if there was a key it doesn't reorder it self unlike Vector. This might be possible in language like python grin
}
}



Now for a better implementation, that only came to my head as i was not overthinking immediately after the interview.


struct Lottery {
user: Vec<String>,
}

impl Lottery {
fn add_user(&mut self, string: user){
// we just insert
self.user.push(user);
}

fn remove_user(&mut self, string: user){
// linear search and then remove
if self.participant.contains(&participant) {
self.participant.retain(|x| x != &participant);
}
}

fn pick_random_user(&self){
let random_gen = // algorithm that generate random number
let random = random_gen % self.user.len();
self.user[random]
}
}


Anyways we move!!. Best advice? CALM DOWN! Technical interview are fun but trust 9ja network to Bleep you up.

39 Likes

Re: I Just Bombed A Technical Interview by satandeterrible: 4:40pm On Feb 21, 2023
Shame on you.
Re: I Just Bombed A Technical Interview by robinhood171200: 6:36pm On Feb 21, 2023
better luck next time bro. another opportunity will surely come. can i dm you privately or send you an email? i'd like to ask for your opinion/advice on some tech related issues.
Deicide:
grin Too much pressure that i couldn't even think straight. The question is not even that hard simple data structure question that i can't even believe i bombed it. Chai.

I was asked to implement a Lottery system. that has the following functionality.


1. add_user(string: user)
2. remove_user(string: user)
3. pick_random_winner() -> string


Yes that was how easy it was but i bombed. Immediately i saw add and remove my mind immediately went to the king of all data structure HashMap grin but boy i was wrong a vector would do just fine, the problem here is the functionality to pick_random_user and the function signature. how do you do that with a HashMap if data are stored anywhere in memory? meanwhile in Array everything stored contiguously. But i was busy thinking of speed embarassed

In as much as hash map would be good for add and removal in 0(1) time. it's bad for random access.

could use HashSet but random would still Bleep you up.

My bad implementation.


struct Lottery {
map: HashMap<i32, String>,
}

impl Lottery {
// first problem realized here, what would be the key? and i don already talk say na hash map go good for this things o chai grin

fn add_user(&mut self, string: user){
// But this would not work it doesn't work that way. it would have made sense if the function has a signature for key.
self.map.insert(user); error, where is the key ? cry
}

fn remove_user(&mut self, string: user){
//no key can't remove anything tongue
}

fn pick_random_user(&self){
// impossible!!! no key no random - even if there was a key it doesn't reorder it self unlike Vector. This might be possible in language like python grin
}
}



Now for a better implementation, that only came to my head as i was not overthinking immediately after the interview.


struct Lottery {
user: Vec<String>,
}

impl Lottery {
fn add_user(&mut self, string: user){
// we just insert
self.user.push(user);
}

fn remove_user(&mut self, string: user){
// linear search and then remove
if self.participant.contains(&participant) {
self.participant.retain(|x| x != &participant);
}
}

fn pick_random_user(&self){
let random_gen = // algorithm that generate random number
let random = random_gen % self.user.len();
self.user[random]
}
}


Anyways we move!!. Best advice? CALM DOWN! Technical interview are fun but trust 9ja network to Bleep you up.

2 Likes

Re: I Just Bombed A Technical Interview by Temmylee01(m): 6:39pm On Feb 21, 2023
Deicide:
grin Too much pressure that i couldn't even think straight. The question is not even that hard simple data structure question that i can't even believe i bombed it. Chai.

I was asked to implement a Lottery system. that has the following functionality.


1. add_user(string: user)
2. remove_user(string: user)
3. pick_random_winner() -> string


Yes that was how easy it was but i bombed. Immediately i saw add and remove my mind immediately went to the king of all data structure HashMap grin but boy i was wrong a vector would do just fine, the problem here is the functionality to pick_random_user and the function signature. how do you do that with a HashMap if data are stored anywhere in memory? meanwhile in Array everything stored contiguously. But i was busy thinking of speed embarassed

In as much as hash map would be good for add and removal in 0(1) time. it's bad for random access.

could use HashSet but random would still Bleep you up.

My bad implementation.


struct Lottery {
map: HashMap<i32, String>,
}

impl Lottery {
// first problem realized here, what would be the key? and i don already talk say na hash map go good for this things o chai grin

fn add_user(&mut self, string: user){
// But this would not work it doesn't work that way. it would have made sense if the function has a signature for key.
self.map.insert(user); error, where is the key ? cry
}

fn remove_user(&mut self, string: user){
//no key can't remove anything tongue
}

fn pick_random_user(&self){
// impossible!!! no key no random - even if there was a key it doesn't reorder it self unlike Vector. This might be possible in language like python grin
}
}



Now for a better implementation, that only came to my head as i was not overthinking immediately after the interview.


struct Lottery {
user: Vec<String>,
}

impl Lottery {
fn add_user(&mut self, string: user){
// we just insert
self.user.push(user);
}

fn remove_user(&mut self, string: user){
// linear search and then remove
if self.participant.contains(&participant) {
self.participant.retain(|x| x != &participant);
}
}

fn pick_random_user(&self){
let random_gen = // algorithm that generate random number
let random = random_gen % self.user.len();
self.user[random]
}
}


Anyways we move!!. Best advice? CALM DOWN! Technical interview are fun but trust 9ja network to Bleep you up.
What language is this

17 Likes

Re: I Just Bombed A Technical Interview by Deicide: 7:01pm On Feb 21, 2023
robinhood171200:
better luck next time bro. another opportunity will surely come. can i dm you privately or send you an email? i'd like to ask for your opinion/advice on some tech related issues.
My Email on this account, I don't even know the password
Re: I Just Bombed A Technical Interview by Deicide: 7:02pm On Feb 21, 2023
Temmylee01:
What language is this
The almighty Rust

12 Likes 1 Share

Re: I Just Bombed A Technical Interview by stanliwise(m): 8:28am On Feb 22, 2023
like you say a vector an array is just fine. I think you're overthinking data structure
Re: I Just Bombed A Technical Interview by LikeAking: 8:48am On Feb 22, 2023
Deicide:
grin Too much pressure that i couldn't even think straight. The question is not even that hard simple data structure question that i can't even believe i bombed it. Chai.

I was asked to implement a Lottery system. that has the following functionality.


1. add_user(string: user)
2. remove_user(string: user)
3. pick_random_winner() -> string


Yes that was how easy it was but i bombed. Immediately i saw add and remove my mind immediately went to the king of all data structure HashMap grin but boy i was wrong a vector would do just fine, the problem here is the functionality to pick_random_user and the function signature. how do you do that with a HashMap if data are stored anywhere in memory? meanwhile in Array everything stored contiguously. But i was busy thinking of speed embarassed

In as much as hash map would be good for add and removal in 0(1) time. it's bad for random access.

could use HashSet but random would still Bleep you up.

My bad implementation.


struct Lottery {
map: HashMap<i32, String>,
}

impl Lottery {
// first problem realized here, what would be the key? and i don already talk say na hash map go good for this things o chai grin

fn add_user(&mut self, string: user){
// But this would not work it doesn't work that way. it would have made sense if the function has a signature for key.
self.map.insert(user); error, where is the key ? cry
}

fn remove_user(&mut self, string: user){
//no key can't remove anything tongue
}

fn pick_random_user(&self){
// impossible!!! no key no random - even if there was a key it doesn't reorder it self unlike Vector. This might be possible in language like python grin
}
}



Now for a better implementation, that only came to my head as i was not overthinking immediately after the interview.


struct Lottery {
user: Vec<String>,
}

impl Lottery {
fn add_user(&mut self, string: user){
// we just insert
self.user.push(user);
}

fn remove_user(&mut self, string: user){
// linear search and then remove
if self.participant.contains(&participant) {
self.participant.retain(|x| x != &participant);
}
}

fn pick_random_user(&self){
let random_gen = // algorithm that generate random number
let random = random_gen % self.user.len();
self.user[random]
}
}


Anyways we move!!. Best advice? CALM DOWN! Technical interview are fun but trust 9ja network to Bleep you up.

This is how an tech interview shud be.

U go get it write next time.

E go beta.

2 Likes

Re: I Just Bombed A Technical Interview by richebony: 9:52am On Feb 22, 2023
Deicide:
The almighty Rust

Hope u don't mind my asking, but how many programming languages do u actually know.,because I have seen u write in several languages

2 Likes

Re: I Just Bombed A Technical Interview by OdogwuMoney6: 10:07am On Feb 22, 2023
I pray you continue bombing all your interviews like this in Jesus name, amen..

2 Likes 1 Share

Re: I Just Bombed A Technical Interview by robinhood171200: 10:29am On Feb 22, 2023
Deicide:
My Email on this account, I don't even know the password
whatsapp? twitter? anywhwere i could text you privately.
Re: I Just Bombed A Technical Interview by Deicide: 1:41pm On Feb 22, 2023
robinhood171200:
whatsapp? twitter? anywhwere i could text you privately.
https://twitter.com/MrLectus?s=09
Re: I Just Bombed A Technical Interview by Deicide: 1:43pm On Feb 22, 2023
richebony:


Hope u don't mind my asking, but how many programming languages do u actually know.,because I have seen u write in several languages
You sure say Na me
Re: I Just Bombed A Technical Interview by Akonimohate12: 2:49pm On Feb 23, 2023
grin angry

4 Likes

Re: I Just Bombed A Technical Interview by Mide337: 2:49pm On Feb 23, 2023
Hmm
Re: I Just Bombed A Technical Interview by SenatePresdo(m): 2:49pm On Feb 23, 2023
grin
Re: I Just Bombed A Technical Interview by Mrregistration: 2:50pm On Feb 23, 2023
I greet you in the name of CAC work

Re: I Just Bombed A Technical Interview by Peterobi90: 2:50pm On Feb 23, 2023
🤦‍♂️🤦‍♂️

1 Like

Re: I Just Bombed A Technical Interview by Ishilove: 2:50pm On Feb 23, 2023
Deicide:
grin Too much pressure that i couldn't even think straight. The question is not even that hard simple data structure question that i can't even believe i bombed it. Chai.

I was asked to implement a Lottery system. that has the following functionality.


1. add_user(string: user)
2. remove_user(string: user)
3. pick_random_winner() -> string


Yes that was how easy it was but i bombed. Immediately i saw add and remove my mind immediately went to the king of all data structure HashMap grin but boy i was wrong a vector would do just fine, the problem here is the functionality to pick_random_user and the function signature. how do you do that with a HashMap if data are stored anywhere in memory? meanwhile in Array everything stored contiguously. But i was busy thinking of speed embarassed

In as much as hash map would be good for add and removal in 0(1) time. it's bad for random access.

could use HashSet but random would still Bleep you up.

My bad implementation.


struct Lottery {
map: HashMap<i32, String>,
}

impl Lottery {
// first problem realized here, what would be the key? and i don already talk say na hash map go good for this things o chai grin

fn add_user(&mut self, string: user){
// But this would not work it doesn't work that way. it would have made sense if the function has a signature for key.
self.map.insert(user); error, where is the key ? cry
}

fn remove_user(&mut self, string: user){
//no key can't remove anything tongue
}

fn pick_random_user(&self){
// impossible!!! no key no random - even if there was a key it doesn't reorder it self unlike Vector. This might be possible in language like python grin
}
}



Now for a better implementation, that only came to my head as i was not overthinking immediately after the interview.


struct Lottery {
user: Vec<String>,
}

impl Lottery {
fn add_user(&mut self, string: user){
// we just insert
self.user.push(user);
}

fn remove_user(&mut self, string: user){
// linear search and then remove
if self.participant.contains(&participant) {
self.participant.retain(|x| x != &participant);
}
}

fn pick_random_user(&self){
let random_gen = // algorithm that generate random number
let random = random_gen % self.user.len();
self.user[random]
}
}

Kuku kee person. Mscheeeeeew

1 Like 1 Share

Re: I Just Bombed A Technical Interview by Ishilove: 2:51pm On Feb 23, 2023
Akonimohate12:
grin angry
Fake news

1 Like

Re: I Just Bombed A Technical Interview by Offpoint1: 2:51pm On Feb 23, 2023
grin
Re: I Just Bombed A Technical Interview by Newbietroll: 2:51pm On Feb 23, 2023
Better luck next time bro. Nigeria happens to all of us at one point or the other.

1 Like

Re: I Just Bombed A Technical Interview by 9jatriot(m): 2:51pm On Feb 23, 2023
Send them an email with your new solution, you never can tell.

Just tell them that you came up with a much simpler solution after you got off the interview. Nothing to lose here

If they do not have anyone better than you within that interview itself, rather than conduct a new one, they may call you again

44 Likes 1 Share

Re: I Just Bombed A Technical Interview by thaoriginator: 2:52pm On Feb 23, 2023



Whot sort of raaaabisssshhhhh is this? cry
Re: I Just Bombed A Technical Interview by Wealthoptulent(m): 2:52pm On Feb 23, 2023
Ur use of English sef! The BOMB
Re: I Just Bombed A Technical Interview by solamakinde1: 2:53pm On Feb 23, 2023
My heart beats faster when I hear anything DSA
Re: I Just Bombed A Technical Interview by sofeo(m): 2:56pm On Feb 23, 2023
Alright


Check my Signature
Re: I Just Bombed A Technical Interview by Ulunne777(f): 2:59pm On Feb 23, 2023
Let us pretend we understand.
Goodluck

14 Likes

Re: I Just Bombed A Technical Interview by DasBeste: 2:59pm On Feb 23, 2023
satandeterrible:
Shame on you.

You dey mean o grin

(1) (2) (3) (Reply)

How Much Do Web Developers Earn In Nigeria? / Why People Always Think Those That Make Use Of Laptop Are Into Fraud? / Interested In Teaching Yourself Programming? file on link

Viewing this topic: 1 guest(s)

(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. 53
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.