SarthakKeshari / CPP-Questions-and-Solutions

This repository aims to solve and create new problems from different spheres of coding. A path to help students to get access to solutions and discuss their doubts.
MIT License
47 stars 132 forks source link

Odd after even LinkedList #413

Closed anshuman725 closed 2 years ago

anshuman725 commented 2 years ago

Enter your question -

For a given singly linked list of integers, arrange the elements such that all the even numbers are placed after the odd numbers. The relative order of the odd and even terms should remain unchanged.

Test Cases-

Sample Input 1 : 1 1 4 5 2 -1

Sample Output 1 : 1 5 4 2

Sample Input 2 : 2 1 11 3 6 8 0 9 -1 10 20 30 40 -1

Sample Output 2 : 1 11 3 9 6 8 0 10 20 30 40

Enter link to the question(if question belongs to any online platform) -

Link to Question

Tags for the question(eg - Array, Basic, Stack, etc.) -

LinkedList

anshuman725 commented 2 years ago

@SarthakKeshari kindly issue me this problem

SarthakKeshari commented 2 years ago

@anshuman725, May I know, is this question from GeeksForGeeks?

anshuman725 commented 2 years ago

@anshuman725, May I know, is this question from GeeksForGeeks?

@SarthakKeshari it's from the course of Coding Ninja's, But we can find this question on GeeksForGeeks as Well.

SarthakKeshari commented 2 years ago

@anshuman725, Kindly mention all the links. It will help the learners visiting your code to get the references

anshuman725 commented 2 years ago

@SarthakKeshari Done!

diwakar1998 commented 2 years ago

can multiple people solve same issue?

SarthakKeshari commented 2 years ago

can multiple people solve same issue?

@diwakar1998, No, only "admin-choice" questions can be solved by multiple people.

SarthakKeshari commented 2 years ago

@anshuman725, Kindly add your solution to "GeeksForGeeks" folder. Deadline - 13/10/2021