BlackFridaySaleJoin the waitlist for an extra exclusive deal
Extra savings end in
00Days
02Hrs
12Mins
45Secs
Limited spots only
ONE-STOP LEARNING PLATFORM

Interview around the corner?

Get your personal plan, with our resources.

Your Goals

I am preparing for :

SDE InternSoftware Engineer

Subjects to focus :

DSAOOPSLLDHLDAptitudeOSDBMS

Hours per week

M2hT-W8hT-F9hS-S4h
Generate

Customize your Plan

Week 1W2W3 . . . . W8
MDSA3 hr
TDSA4 hr
WRest day-
TLLD5 hr
FOOPS2 hr
SRest day-
SOS5 hr

Prepare

Mondayweek 1
MTWTFSS
Greedy Algo15m
Two sum20m
Binary search30m
Solid Principles15m
Trees30m

*Skip a day? Your plan adjusts
automatically.

Weekly process

WeekNotesQuiz
W 018/10
W 029/10
W 030/10
W 041/10
W 052/10
W 065/10
W 078/10
W 088/10
Interview Ready

in 8 weeks

0+ learners signed up

In the last 3 years

Learn from sheets trusted by millions

A2Z, Striver’s 75 and more.

The best way to learn.

Read, attempt, learn, ask TUFY, note, save.

1. Two Sum

Basic

Given an array of integers nums and an integer target, return the indices of two elements whose sum is target.

Each input has exactly one solution. You cannot use the same element twice, and you may return the indices in any order.

Example 1

Input: nums = [1, 6, 2, 10, 3], target = 7
Output: [0, 1]
Explanation: nums[0] + nums[1] = 1 + 6 = 7

Example 2

Input: nums = [1, 3, 5, -7, 6, -3], target = 0
Output: [1, 5]
Explanation: nums[1] + nums[5] = 3 + (-3) = 0
Now Your Turn!

For nums = [-6, 7, 1, -7, 6, 2] and target = 3, which indices work?

Hints

Hint 1

For each value, look for target − value among the values you have already seen.

Frequently Occurring Doubts

Can I use the same element twice?

No. The two indices must point to different positions in the array.

Can the answer contain negative numbers?

Yes. The prompt allows negative values, so account for them in your search.

Interview Follow-up Questions

What if there are multiple valid pairs?

Return any pair unless the interviewer asks for every unique pair.

Constraints

2 ≤ nums.length ≤ 10⁵ · −10⁴ ≤ nums[i] ≤ 10⁴ · Exactly one valid answer exists.

Similar Problems

3 Sum · 4 Sum · Two Sum II

Java
Test Case ›SampleHidden⌄
Input:
nums[1, 6, 2, 10, 3]
target7

Practice what they actually ask.

Pick a company. Pick a window. Get its question set.

Free to learn. Plus to be ready.

4000+ videos, Planly, TUFY and much more

4,000+video solutions on Plus

FreePlus
DSA: Selected YouTube solutionsIncludedIncluded
DSA: New video solutions (~200)—Included
C++: Practice problem solutions—Included
DBMS—Included
OS—Included
CN—Included
OOPs—Included
LLD—Included
SQL—Included
Planly study plan by goal, level & daily time—Included
Planly reschedules missed tasks and days—Included
Selected revision imagesIncludedIncluded
Quick revision slides—Included
Manual notesIncludedIncluded
AI revision notes—Included
Submission notes—Included
Account code storage—Included
Full sheet curriculumIncludedIncluded
C++: TheoryIncludedIncluded
Community articlesIncludedIncluded
In-depth editorials by engineers—Included
DSA chapters: Brute, Better & Optimal—Included
Videos, editorials, notes & practice in one place—Included
Study Mode—Included
Problem hintsIncludedIncluded
Code hints from TUFY—Included
Concept explanations and follow-ups from TUFY—Included
Ask TUFY at any video timestamp—Included
Free practice questionsIncludedIncluded
Plus practice questions—Included
C++: Practice problems—Included
Company-tagged questions (last 30/60/90 days)—Included
AI Code Review for correct submissions—Included
Interview follow-ups on your solution—Included
Topic quizzes—Included
Contests—Included
Practice timerIncludedIncluded
Priority support—Included

Their offers started here.

Hall of Fame

Where they landed

Nilesh BahetiAmazon

“Tuf give me a detailed roadmap about what to follow in my dsa journey ,with the help of tuf i was able to crack multiple product based company's like Razorpay , ukg and Amazon.”

RRohit SharmaAmazon

“I started my dsa journey from Tuf content and it played a mazor role to build my consistency and confidence. The structured roadmap and problem explanation with concept easier to understand and apply. Because of striver's guidence i was able to improve my problem solving skill and got my internship oppertunity.I genuinely recomend the platform to preparinf tech interviews , it is one of the best resources out of there.”

AAditi PrakashMicrosoft

“Previousely i couldn't able to solve complex question's after i learned from Tuf i was able to solve questions and the way striver written the code it is very easy to understand and the approach are very helpful and who is currently in my place , you can checkout Tuf channel.”

Muskaan SinghalMicrosoft

“Tuf help me a lot because it gives me a proper part to follow so instead of randomely solving questions i had a clear idea at what topics and patterns i needed to work on. It definitely made me more confident.”

Vanshika AgarwalGoogle

“I did all my interview preparetion from Tuf and striver's playlist were really savior for me. That really helped me to crack all these interviews. The tab explanation the reaching to the solution and explanations and understanding the concepts instead of just cramming the solution to a particular solution is what helped me to built the logic i think these are the points that really may striver atand apart from the other creators and other resources.Striver is the biggest part of my journey and success.”

RRenuka Ganga DevakotiGoogle

“I had learnt dsa from Tuf from Tuf i had learned how to think when a problem is given such as analyzing constraints time and space complexity, which enahanch my problem solving skills.”

Chandranshu BhardwajSalesforce

“Previousely i was not sure what to follow , someone suggest me to learn from Tuf . The content was very accurate and i was able to practice and solve lot of questions. I suggest to the juniors stay consistant and follow Tuf sheet and always think positive.”

Podila Preetham KumarIBM

“Tuf really helped me a lot to solve the dsa pattern.”

Ishanvi SrivastavaTexas Instruments

“To be honest Tuf gives what all we needed . Understanding dsa through questions and i love strivers explanation .”

AryanARISTA Networks

“In my interview most of the question comes from the oops playlist .Tuf explains in better , brute and optimal solution so that it's very easy to understand.”

Sagar ThapliyalHoneywell Aerospace

“Tuf gives me a structured path where i was having in-depth explanation with a better quality and the notes are incredibly helpful.”

Divyanshu SharmaDeloitte

“Tuf didn't just help me to build in solution but also helped me to present my solution in front of interviewer.”

Paleti VarunVisa

“Tuf solved my problem by a sheet based approach and all the sheets are well designed. Striver's video explanation are top notch which helped to understand complex questions.”

Trisha RajFiserv

“Tuf helped me to solve the dsa problem topic by topic and it helped me in recognizing the patterns.Tuf helped me to grab the oppertunity.”

Shreyas MekheNPCI

“The Tuf sheet was very structured all the problems from different topics were in the sheet . It slowly give me confidence.”

Abhishek PandeyPublicis Sapient

“Tuf gives a structured path and quality resources. Tuf made my preparetion more focused and overwhelming.”

Vaibhav RajEpam systems

“Tuf helped me to learn all the concepts . geve a proper roadmap .”

Shashikiran VBT Group

“Tuf is a structured platform . The questionsis very useful. One feature i loved the most that is the article. The person who is very confused go through tuf all the question and topics.”

Yash ChaturvediDrdo Hq

“Striver has explained each and everything in such a way that it really improves our pattern recognization ability which one of the key factor in dsa.”

In their own words

AmazonVaibhav Shaw
AmazonDiksha Sharma
MicrosoftAvinash Gottapu
CiscoPiyush Bhondave
CiscoSurya Kiran
OracleRahul Jindal
Hewlett Packard Enterprise (HPE)Aditya Mittal
SAP Labs / ZeptoPranshu Awasthi
SanDiskHrishikesh Deshpande
Deloitte USIRitul Mamdapur
RazorpayPratik Kumar Sinha
BNYSmurti Akash Jena
FiservPulkit Gupta
Grab(By Reliance)Prashasti Saxena
Epam SystemsRakesh Muntha
Epam systemsKulwinder singh
Societe GeneraleRaj Kumar Jaiswal
NTT-ATSameeran Nikam

A little note before you begin.

Directly from the founder.

Hey, I'm Raj. You probably know me as Striver.

My journey started at a tier-3 college, took me to an internship at Amazon, then Media.net, and nearly four years at Google. Today, I'm building takeUforward full-time, with 1M+ learners trusting us with their preparation.

But this is where your journey matters. Maybe you're chasing a dream company, hoping to support your family, or wondering if someone from your background can make it.

"Where you start doesn't have to decide how far you go."

Some days, things will click. Others will take a few more attempts. Give yourself that time – you're learning, and you don't have to figure everything out at once.

Let's take the next step together.

Raj Vikramaditya, founder of takeUforward
Raj VikramadityaFounder | Ex - Google, Amazon, Media.net

Head over to Prep Hub.

Every sheet is there: A2Z, Striver’s 75, Blind 75, Core CS and more.
Free to start, Plus when you want more.

Question first?

Request a callback from us