Practice Real Company Assessment Patterns • Latest 2025–2026 Mock Tests

Programming Exercises

Write a function to partition a list of integers such that all even numbers appear before odd numbers

Hard

Problem Statement

Write a function to partition a list of integers such that all even numbers appear before odd numbers

Sample Input

[3, 1, 2, 4]

Sample Output

[4, 2, 1, 3]

Limits

Time: 2s · Memory: 256 MB

Code Editor
00:00
import java.util.*; public class Main { public static void partitionEvenOdd() { int[] arr = {3, 1, 2, 4}; // Your code here } }
Log in or sign up to run or submit your code.Log inSign up
Input
[3, 1, 2, 4]
Expected Output
[4, 2, 1, 3]