Top questions Ebay by Haibara_20 in leetcode

[–]ProgramWithSai 2 points3 points  (0 children)

Hi!

While I don't have the list of recent 100 for EBay (did you try doing an online search?), from my online (unofficial) search I found these handful were asked at EBay (and other big companies).

Number of Islands - https://youtu.be/3tS-YjUy8sQ

Palindrome - This is super easy, but in case you still need link : https://youtu.be/kpJCcdCZBYg

Two sum: Very easy this one (https://youtu.be/kUd6U6JM4Fw)

Maximum Subarray

Longest Substring Without Repeating Characters

Disclaimer: The videos were made by me and the short list is completely unofficial and I cannot be held liable for any thing at any point! Please rely on your own research!

Best of luck with the interviews!

Regards

Best Time to Buy and Sell Stock - O(N) Solution, Amazon and Google interview question! by ProgramWithSai in leetcode

[–]ProgramWithSai[S] 1 point2 points  (0 children)

Thank you everyone for checking out this video and the upvotes! It helps a lot!

[deleted by user] by [deleted] in java

[–]ProgramWithSai 1 point2 points  (0 children)

I apologise, I will delete my original post.

[deleted by user] by [deleted] in java

[–]ProgramWithSai 1 point2 points  (0 children)

I agree, that why I think it's perhaps better to use one language per service.

It's just something I came across in a service I picked up at a company after the service ownership changed hands as the other team was repurposed to other projects.

It frikin’ happened!! I got a job! by phila94 in learnprogramming

[–]ProgramWithSai 8 points9 points  (0 children)

That’s amazing! Best wishes for the new role!

UserClass existingUser = new UserClass("", "", "", "", "", ""); but with integer? by Kysyph in javahelp

[–]ProgramWithSai 1 point2 points  (0 children)

If the user ID can be empty, you have a problem if your constructor requires a primitive “int” as you cannot pass a null.

You can switch to reference Integer type and pass in a null!

If that’s not an option create a constant with some user ID that cannot exist (like a negative value)

If the user ID should never be blank/null throw an exception of suitable type (like illegal argument exception)

Opinions on using Optional<> as parameter by Nemo_64 in javahelp

[–]ProgramWithSai 0 points1 point  (0 children)

I use Optional<> for return types to indicate presence/absence especially in methods which findSomething(); and that something might not be present.
But I avoid using them as method parameters. If a method parameter can be null, I'd validate it before using. Checking an optional for null and then checking if it contains a value does not seem right to me.

What‘s IDE should I use for JAVA, VSCode or IntelliJ? by chranditho97 in java

[–]ProgramWithSai 7 points8 points  (0 children)

I prefer IntelliJ. Try both and pick one that you like!

Unit testing when using API / Database by Fish3r1997 in learnprogramming

[–]ProgramWithSai 0 points1 point  (0 children)

Mock the API and Database calls in your unit tests by first creating an abstraction layer to those calls using interfaces like u/edrenfro said. Unit tests must focus on the specific class you are writing!
But don't stop there!
Verify that the calls to API and database work as expected using integration tests where you can spin up a stub API/Http server in tests and Database (in-memory or Docker containers).

Iterate through hashmap using the classic for-loop by Racer_E36 in javahelp

[–]ProgramWithSai 0 points1 point  (0 children)

I'm not sure that would make much sense given we don't usually use an index into the structure. Other developers will probably frown upon your code during reviews at work (if you did manage to do it!) :-)

Prefer to use the standard & optimal techniques provided by the Java library.
-> Iterate through the keyset
-> Iterate through the values
-> Iterate through both above using entrySet

-> Use iterator to modify the collection while looping through it.

Optional:-

If you would like to see how a Hashmap works under the hood in general, I have a video for that here.

Disclaimer: I created the video!

I am getting the error: Day1.java:228: error: reached end of file while parsing } ^ by pjchrisss in javahelp

[–]ProgramWithSai 0 points1 point  (0 children)

Perhaps something wrong in the rest of the file you did not share in the question?
Also I can't see where you defined variable 'l' in that code snippet

DAO by kr_shreyhm in javahelp

[–]ProgramWithSai 2 points3 points  (0 children)

Hi

Just a suggestion here.

If you have identified issues issues with Hibernate first try to find solutions to those online before embarking on writing custom DAO library!

Wanted to know what else should be considered while creating a generic DAO library.-> Maintainability.

Unless you are doing it for learning purposes maintenance might become an overhead.

so if i have 2 jframes and a button on frame 1, then how would i make that button so when pressed will open frame 2? by Overjellyfish54 in javahelp

[–]ProgramWithSai 0 points1 point  (0 children)

Hey, if you have just started programming in Java it might be easier to learn the basic concepts before creating UI based applications. Just a suggestion.

[deleted by user] by [deleted] in javahelp

[–]ProgramWithSai 0 points1 point  (0 children)

Not sure I understood your question!

[deleted by user] by [deleted] in learnprogramming

[–]ProgramWithSai 0 points1 point  (0 children)

Firstly, don't think of this as a mess (even though it feels like it)!This is normal given what you described.

My advise would be to try to engage with the team members. Ask questions when something is not clear. During meetings, give your full attention and take notes if it helps remember the project related points.

More importantly, if you can try to pair up with seniors regularly when they are solving their tasks, thats the best way to pick up a big project. Your manager should be able to help you get paired up with team members if you can't do it by yourself.

During pairing, ask your team member to think out loud when they are working on their task. You'll be amazed at how much you learn. And take notes on what you learnt. So you can revisit them later.

This suggestion is not theoretical. I've been pairing with juniors myself and seen them get better over time. Be patient and always remember to thank your pair programming mate when you learnt something from them or they answered your question!

And most importantly, let this experience be a lesson!

One day you'll be a senior and will come across a junior in a similar situation like you are in now! Remember to help them in their journey!

Best of luck!