Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,155,888 members, 7,828,146 topics. Date: Wednesday, 15 May 2024 at 03:03 AM |
Nairaland Forum / Science/Technology / Programming / See The Question I Was Asked During An Online Interview (2121 Views)
I Asked Chatgpt To Write A Poem About Nairaland. Here's The Output / with how Much Can I create An Online Retail Website And APP? / Then I For Some Reason Didn't Reach The Question. (2) (3) (4)
See The Question I Was Asked During An Online Interview by Peterpan007(m): 10:35am On Oct 16, 2022 |
See the question I was asked
|
Re: See The Question I Was Asked During An Online Interview by RepoMan007: 11:13am On Oct 16, 2022 |
You came to tell us instead of trying. Did the interviewer disable your PrintScreen button? 1 Like |
Re: See The Question I Was Asked During An Online Interview by Fourpockets: 11:49am On Oct 16, 2022 |
Peterpan007:Is it a foriegn remote job interview |
Re: See The Question I Was Asked During An Online Interview by Peterpan007(m): 12:48pm On Oct 16, 2022 |
RepoMan007: Nope!!!! I actually did but I want to see if I was on point or I missed it |
Re: See The Question I Was Asked During An Online Interview by Peterpan007(m): 12:49pm On Oct 16, 2022 |
Fourpockets: Nope a Nigerian tech company... |
Re: See The Question I Was Asked During An Online Interview by tensazangetsu20(m): 1:10pm On Oct 16, 2022 |
Use a hash map and your key should be the opening values of the given HTML tags. The values should be it's coresponding closing tag. Split string and loop through and if opening tag and closing tag of each element is found return true else false 1 Like |
Re: See The Question I Was Asked During An Online Interview by Nobody: 1:29pm On Oct 16, 2022 |
tensazangetsu20:split it by what? 1 Like |
Re: See The Question I Was Asked During An Online Interview by Nobody: 1:33pm On Oct 16, 2022 |
My approach would probably be to use substrings? get first index of ">" to get the end of an opening tag, then get last index of "<" to get the start of the last closing tag. cut the string and compare the tags repeat till there is no "<>" Seems oddly inefficient though |
Re: See The Question I Was Asked During An Online Interview by tensazangetsu20(m): 1:36pm On Oct 16, 2022 |
DrLevi: You can split the string normally so it's an array when you loop through it. I also forget you need to keep a visited array that will either return true or false if we find all keys or not. If theres ever a false in the array return false if it's all true return true. 1 Like |
Re: See The Question I Was Asked During An Online Interview by Fourpockets: 1:50pm On Oct 16, 2022 |
Peterpan007:Ok Hint, split the string into an array so it'll be easier to work on |
Re: See The Question I Was Asked During An Online Interview by islamics(m): 3:33pm On Oct 16, 2022 |
@tensa Is it possible to split a string without a delimeter? I think that is what @DrLevi means by asking "split by what?". @Op Flexisaf is showing in your browser oooo; is this for Flexisaf? My idea of solving never balance for head. I am thinking of stack stuff. Like the common bracket problem. |
Re: See The Question I Was Asked During An Online Interview by tensazangetsu20(m): 4:35pm On Oct 16, 2022 |
Op I hope you didn't switch tabs when taking this test. We use coderbyte at the company I work for and I volunteered to take our recruitment test to gauge how fair it is to applicants and it practically takes a video of your screen. It also notifies how many times you leave the tab and if you copy or paste when you switch tabs it flags your answers for plagiarism which leads to an automatic rejection. 10 Likes |
Re: See The Question I Was Asked During An Online Interview by faruqa97: 4:42pm On Oct 16, 2022 |
Why would you be given 5 minutes for this question or am I seeing something else, anyway, you split the string by byte, since this is an HTML question, you can assume UTF-8 encoding, you don't have to split everything at once and then store in memory, you can do it byte by byte and switch the state machine depending on the character emitted, more like tokenization. Here is the thing, this question, requires the knowledge of state machine and a basic understanding of HTML spec or the algorithm it uses in closing unclosed tags (I don't even think you need it self), it's a simple algorithm, you can use stack for it. Let me give you a quick way I'll solve this, whenever you encounter an opening tag (e.g <div>, you push it in the stack of open tags, when you encounter it's closing partner (e.g </div>), you loop the opening tag stack backwards until you match it's opening tag, and as such, you close it. I didn't see the last section of that question but it seems it is saying, you should return the tag that wasn't closed, you can either record the tags that wasn't closed while you were pushing to the opening tag stack, or loop the opening tag stack until you found one that isn't closed, then return it. 1 Like |
Re: See The Question I Was Asked During An Online Interview by LikeAking: 4:53pm On Oct 16, 2022 |
Nice! It's a leetcode questions in disguise.. Using a simple hash map will do the trick.. 1 Like |
Re: See The Question I Was Asked During An Online Interview by Hannania(m): 5:25pm On Oct 16, 2022 |
Peterpan007:Valid Parentheses come to mind right now 1 Like |
Re: See The Question I Was Asked During An Online Interview by namikaze: 7:37pm On Oct 16, 2022 |
Peterpan007:This is valid parentheses in disguise, simplifying the input should work, something like:
1 Like |
Re: See The Question I Was Asked During An Online Interview by namikaze: 7:39pm On Oct 16, 2022 |
Hannania:exactly 1 Like |
Re: See The Question I Was Asked During An Online Interview by Peterpan007(m): 7:53pm On Oct 16, 2022 |
islamics: Yes it for flexisaf |
Re: See The Question I Was Asked During An Online Interview by Peterpan007(m): 7:54pm On Oct 16, 2022 |
tensazangetsu20: I didn't switch tabs... I did the obj section and this was the second part. |
Re: See The Question I Was Asked During An Online Interview by Peterpan007(m): 7:58pm On Oct 16, 2022 |
Thanks guys for the comments. It means a lot at least I've learnt something. I tried to solving it but I didn't go far, I'm sure I did well in the obj section but not to sure of this particular question.. I'm hoping for the best from the interview. Thanks guys |
Re: See The Question I Was Asked During An Online Interview by Peterpan007(m): 7:59pm On Oct 16, 2022 |
namikaze: Omo!!!!! |
Re: See The Question I Was Asked During An Online Interview by emmyN(m): 8:02pm On Oct 16, 2022 |
tensazangetsu20: I took a coderbyte test on Friday and used the built in browser feature to look up some MDN documentation stuff. But when I clicked on the search result, it opened in a new tab. Could this be grounds for disqualification too? |
Re: See The Question I Was Asked During An Online Interview by tensazangetsu20(m): 8:07pm On Oct 16, 2022 |
Peterpan007: const openingTags = str.match(/<\w+>/g) const closingTags = str.match(/(<\/\w+>/g); const strObj = { '<div>': '</div>', '<p>': '</p>', '<i>': '</i>', '<p>': '</p>', '<em>': '</em>', '<b>': '</b>', }; // there might not be the same number of opening and closing tags const max = Math.max(openingTags.length, closingTags.length); for (let i = 0; i < max; i++) { if (strObj[openingTags[i]] !== closingTags[closingTags.length - 1] && strObj[openingTags[i]] !== closingTags[0]) { return (openingTags[i]).replace(/<|>/g, ''); } closingTags.splice(closingTags.indexOf(strObj[openingTags[i]]),1); } return "true"; The question has even been solved online https://stackoverflow.com/questions/62462345/how-to-check-if-dom-elements-are-correctly-nested 2 Likes |
Re: See The Question I Was Asked During An Online Interview by tensazangetsu20(m): 8:08pm On Oct 16, 2022 |
emmyN: Yes it actually also checks when you look up things online through their in search engine and tells your employer what exactly you searched for. Please next time when taking another coding assessment. Use another laptop or tablet or mobile device if you intend to search anything. |
Re: See The Question I Was Asked During An Online Interview by emmyN(m): 8:13pm On Oct 16, 2022 |
tensazangetsu20: Okay. Was actually surprised when it opened in a new tab. I think it was a glitch in the system, because the second time I did a search, it used the in-built browser to return the MDN result. |
Re: See The Question I Was Asked During An Online Interview by tensazangetsu20(m): 8:16pm On Oct 16, 2022 |
emmyN: LoL don't mind them it's a trap. |
Re: See The Question I Was Asked During An Online Interview by SeaTrade(m): 8:22pm On Oct 16, 2022 |
tensazangetsu20:Hi bro. Quick one. Please how possible is it to recover data from a dead android phone in Nigeria? I know it's possible cos I've done some research on it and it says it can be recovered using softwares. So I'm wondering If we have capable hands that can do that here as most of these phone guys are just so analogue. |
Re: See The Question I Was Asked During An Online Interview by tensazangetsu20(m): 8:33pm On Oct 16, 2022 |
SeaTrade:Yeah it's possible but then dependent on the level of damage to the phone. The phone still has to come on to be able to access the data through a software. If you are in lagos there's lots of people that will easily do this in computer village |
Re: See The Question I Was Asked During An Online Interview by SeaTrade(m): 8:36pm On Oct 16, 2022 |
tensazangetsu20:Yes it comes on very well,just the display that's bad as the screen remains black throughout, even after changing screen. Okay thank you so much for the information. |
Re: See The Question I Was Asked During An Online Interview by AlchemyOfCodes: 9:22pm On Oct 16, 2022 |
Omo questions dey Sha. Make I kukuma take my leave o |
Re: See The Question I Was Asked During An Online Interview by Peterpan007(m): 9:44pm On Oct 16, 2022 |
tensazangetsu20: See question for internship role oo not junior dev yet oo.. Wawu |
Re: See The Question I Was Asked During An Online Interview by tensazangetsu20(m): 9:53pm On Oct 16, 2022 |
Peterpan007: How much is the salary of the job? |
Please Help A Dumb Guy With Some "PYTHON" Ideas. / What Skillsets Are Needed To Create A World Class Web-based Accounting Software? / Embedded System Engineers 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. 59 |