Skip to content
CampusEduX

Two Sum

Easyjavapythonccppjavascript

Given an array and a target value, determine whether two different positions hold values that add up to the target.

Input Format

The first line contains two integers N and target. The second line contains N space-separated integers.

Output Format

Print 1 if such a pair exists, otherwise print 0.

Related Problems

  • Find the Largest Element
    Easy · java, python, c, cpp, javascript
    Solve Problem
  • Find the Smallest Element
    Easy · java, python, c, cpp, javascript
    Solve Problem
  • Find the Second Largest Element
    Easy · java, python, c, cpp, javascript
    Solve Problem

Input (stdin)

Output

Run your code to see output here...