id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

abraskin@mbusd.org 2016_practice_set_5 > longestPalindrome
prev  |  next  |  chance

Given an array of Strings, return the index of the one that is the longest palindrome.
A palindrome reads the same way forwards as back.
Note: Return -1 if there are no palindromes.
Note: If multiple palindromes are the same length return the index of the last one found.


longestPalindrome(["There", "is", "only", "a", "single", "palindrome", "here"]) → 3
longestPalindrome(["There", "are", "no", "palindromes", "here"]) → -1
longestPalindrome(["racecar", "madam", "supercalifragilisticexpialidocious"]) → 0

...Save, Compile, Run (ctrl-enter)

public int longestPalindrome(String[] arr) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 299

Copyright Nick Parlante 2017 - privacy