List Partitioning

0

0 votes
Easy
Problem

There is a list of n nodes. A number x is given as input, partition the list such that all the nodes with value less than x must come before the node with value greater that or equal to x. Preserve the relative ordering of nodes in the output list.


Input Format: First line contains two integers n and x. Second line contains n space separated integer.
Output Format:
Output the list after partitioning.
Constraints:
All the input integers are well with in the integer range.

Sample Input
6 3
1 4 3 2 5 2
Sample Output
1 2 2 4 3 5
Time Limit: 5
Memory Limit: 256
Source Limit:
Editor Image

?