Given a string, write a method to find the first non-repeating vowel (a, e, i, o, u) in it and return its index. If it doesn't exist, return -1. Assume that all the characters of the String is lowercase. Do not use String class functions other than charAt() and length() You can also try to solve with Map data structure like using a Map variable.

EBK JAVA PROGRAMMING
8th Edition
ISBN:9781305480537
Author:FARRELL
Publisher:FARRELL
Chapter16: Graphics
Section: Chapter Questions
Problem 14RQ
icon
Related questions
Question
100%

Use Java

Practice / First Non-Repeating Vowel
Given a string, write a method to find the first non-repeating vowel (a, e, i, o, u) in it and return its index.
● If it doesn't exist, return -1.
● Assume that all the characters of the String is lowercase.
Do not use String class functions other than charAt() and length()
You can also try to solve with Map data structure like using a Map<Character, Integer> variable.
●
Example
input: google
output: 5
explanation: only e is
non-repeated vowel and it's
index is 5
Example
input: mood
output: -1
explanation: o is repeated, no
non-repeating vowel.
Example
input: responsible
output: 4
explanation: e is repeated, o
and i are not repeated, o is the
first non-repeating vowel
Transcribed Image Text:Practice / First Non-Repeating Vowel Given a string, write a method to find the first non-repeating vowel (a, e, i, o, u) in it and return its index. ● If it doesn't exist, return -1. ● Assume that all the characters of the String is lowercase. Do not use String class functions other than charAt() and length() You can also try to solve with Map data structure like using a Map<Character, Integer> variable. ● Example input: google output: 5 explanation: only e is non-repeated vowel and it's index is 5 Example input: mood output: -1 explanation: o is repeated, no non-repeating vowel. Example input: responsible output: 4 explanation: e is repeated, o and i are not repeated, o is the first non-repeating vowel
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Math class and its different methods
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT