Me already asking myself if this is really serious... Writing code on a white board?
It depends... what is the purpose? 200 is a hard limit, or are we expecting more element to be loaded? Where will the code be used? First viable product, refactoring or optimization? Do we already have a utility library, or this is a one-off case? Without context it would be easiest to write the for(i=0;i<200;i++)(//code) JS.
O(2*n) or 2*O(n) or 2-passes is less efficient than O(n) or a single pass. That is the point the interviewer was trying to get across and also quickly move on from to get back to the real problem at hand. Why not try to think through a hard problem and show the interviewer that you can come up with better ideas rather than arguing semantics about some esoteric math concepts that don't exist in the real world. The point is to see your thought process, you attempted to by sly and take the easy way out while on a job interview. I wouldn't want you on my team either.
Abstraction:- Data abstraction refers to, providing only essential information to the outside world and hiding their background details, i.e., to represent the needed information in program without presenting the details. For example, a database system hides certain details of how data is stored and created and maintained. Similar way, C++ classes provides different methods to the outside world without giving internal detail about those methods and data. Interface An interface is a reference type in Java. It is similar to class. It is a collection of abstract methods. A class implements an interface, thereby inheriting the abstract methods of the interface. Along with abstract methods, an interface may also contain constants, default methods, static methods, and nested types. Method bodies exist only for default methods and static methods.
The differences are both theoretical and practical: 1) interface is a description of some capability your class has and advertises (so various classes implementing the same interface can be used the same way) 2) abstract class can be a default implementation, containing the parts which are likely to appear in all the implementations. It doesn't have to implement the complete interface
I already worked in samsung and this job is similar with previous job
It's essential to demonstrate that you can really go deep... there are plenty of followup questions and (sometimes tangential) angles to explore. There's a lot of Senior Software Engineer experts who've worked at Samsung Electronics, who provide this sort of practice through mock interviews. There's a whole list of them curated on Prepfully. prepfully.com/practice-interviews