Two Sum Leetcode Interview Question part -1 | Most asked Java Coding Interview Questions and Answers

preview_player
Показать описание
Two Sum Coding Interview Question part -1 || Most asked Java Coding Interview Questions and Answers

Udemy Course of Code Decode on Microservice k8s AWS CICD link:

Course Description Video :

In this video we have solved Two sum problem using Java, which is most commonly asked interview question for experience as well as fresher.

The problem in two sum leetcode says : Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to the given required target.

You may assume that each input would have exactly one solution, and you may not use the same element twice at all.

You can return the answer in any order is the flexibility given in two sum leetcode problem.

Example 1 as per two sum leetcode :

Input: nums = [2,7,11,15], target = 9
Output: [0,1]
Output: Because nums[0] + nums[1] == 9, we return [0, 1].

Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.

You may assume that each input would have exactly one solution, and you may not use the same element twice.

You can return the answer in any order.



Example 1:

Input: nums = [2,7,11,15], target = 9
Output: [0,1]
Output: Because nums[0] + nums[1] == 9, we return [0, 1].
Example 2:

Input: nums = [3,2,4], target = 6
Output: [1,2]
Example 3:

Input: nums = [3,3], target = 6
Output: [0,1]


Constraints:

WE have solved this two sum leetcode in three different ways and this oart contains one simple O(n^2) solution which we have reduced till O(2n) and O(n) also using MAP in next video. Please do check that also. Link of the two sum leetcode part 2 is given below

We target to cover most of the questions covered in leetcode.

So what is LeetCode :
It’s a website where people–mostly software engineers–practice their coding skills. There are 800+ questions (and growing), each with multiple solutions. Questions are ranked by level of difficulty: easy, medium, and hard.
LeetCode basically has more questions, better quality, plus a strong user base.

The primary reasons why our users LeetCode: to prepare for the technical portion of a job interview.
LeetCode and the like have risen in use because of the way interviews have evolved. Engineers believe that these resources help prepare them for what they will encounter in today’s technical aptitude screenings.

LeetCode questions are often asked during interviews at the elite tech companies: Facebook, Amazon, Apple, Netflix, and Google., some more than at others. Among the Big Five, Amazon is said to place the least emphasis on LeetCode.

LeetCode is one of the most well-known online judge platforms that you can use to practice your programming skills by solving coding questions. It has over 1,100 different problems, support for over 18 programming languages, and an active community that is always there to help you with the solutions you come up with. If your intention is to hone your coding skills, then this online judge platform is one of the best that you can use.

-------------------------------------------------------------------------------------------------------------------------------------

Code Decode Playlists

-------------------------------------------------------------------------------------------------------------------------------------
Subscriber and Follow Code Decode

--------------------------------------------------------------------------------------------------------------------------------------

#javacodingInterviewQuestions #codedecode #java
Рекомендации по теме
Комментарии
Автор

Don't Mind but that Lady have an awesome way of explaining the things and have better command on words.!! But your explanation is also good.

Sapra
Автор

Nice video good explanation too, but that lady's art of explaining things is really unique easy to understand, by the way object reference name is twoSum and method name is also twoSum it could be different and unique..
Requesting you to pl create or maintain a separate list for these coding interview questions pl.do not put in mix videos.
Thanks for the video

gokulaher
Автор

Please add more code videos bro. Great explanation.

rslakshmicreation
Автор

follow this approach ?
int[] nums = {8, 3, 2, 9, 4, 5} ;
int target = 6;
for (int i = 0; i < nums.length; i++) {
if(nums[i] < target) {

for (int j= i+1; j< nums.length;j++) {
if(nums[j] < target && (nums[i] + nums[j]) == target) {

new int [] {i, j};

}
}

}

krishnap
Автор

no offense the time complexity is too high and this is not even close to being optimised code

vishruthreddy
join shbcf.ru