insidcode
ProblemsDuelLeaderboardStats
Sign In
  1. Home
  2. Problems
  3. Check if an array can be partitioned into two contiguous segments such that both segments have equal sum.

Check if an array can be partitioned into two contiguous segments such that both segments have equal sum.

Difficulty: Medium

Phase: 6 · Mixed Logical Challenges

XP Reward: 20 XP

Topics: Mixed Logical Challenges, Medium

Supported Languages: Python, JavaScript, C, C++, Java

Problem Description

Check if array of N integers can be partitioned into two contiguous segments of equal sum. Print 'Yes' or 'No'. Input Format: Read input from standard input (stdin). Output Format: Print the result to standard output (stdout).

Constraints

  • -10^9 <= N <= 10^9

Examples

Example 1

Input: 4 1 2 3 6

Output: Yes

Explanation: Sample execution for input 4 1 2 3 6