Geeksforgeeks

Error

×

Leaderboard

Showing:

Handle | Score |
---|---|

@Ibrahim Nash | 6454 |

@blackshadows | 6380 |

@mb1973 | 5718 |

@Quandray | 5245 |

@akhayrutdinov | 5111 |

@saiujwal13083 | 5046 |

@sanjay05 | 3762 |

@kirtidee18 | 3709 |

@mantu_singh | 3556 |

@marius_valentin_dragoi | 3523 |

@sushant_a | 3459 |

Complete Leaderboard | |

Handle | Score |

@cfwong8 | 1285 |

@gurshehzadsingh | 1052 |

@pritsahkar2000 | 812 |

@satyamchhatrala | 808 |

@nithinreddy3210 | 801 |

@iib2019024 | 745 |

@mohanreddy8847 | 704 |

@iamchaitanyahegde | 662 |

@shafeeq3543 | 651 |

@workit | 646 |

@AkashLahoty | 642 |

Complete Leaderboard |

Given a linked list of size **N**, your task is to complete the function **isLengthEvenOrOdd() **which contains **head** of the linked list and check whether the length of linked list is even or odd.

**Input:**

The input line contains **T**, denoting the number of testcases. Each testcase contains two lines. the first line contains **N**(size of the linked list). the second line contains N elements of the linked list separated by space.

**Output:**

For each testcase in new line, print "**even**"(without quotes) if the length is even else "**odd**"(without quotes) if the length is odd.

**User Task:**

Since this is a functional problem you don't have to worry about input, you just have to complete the function **isLengthEvenOrOdd() **which takes head of the linked list as input parameter and returns 0 if the length of the linked list is even otherwise returns 1.

**Constraints:**

1 <= T <= 100

1 <= N <= 10^{3}

1 <= A[i] <= 10^{3}

**Example:
Input:**

2

3

9 4 3

6

12 52 10 47 95 0

**Output:**

Odd

Even

**Explanation:
Testcase 1: **The length of linked list is 3 which is odd.

Login to report an issue on this page.

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

YesLoading...

Linked List Length Even or Odd?

...