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

 

jebbert@volusia.k12.fl.us > quiz2023_04_25_SLHL_countAscending
prev  |  next  |  chance

Write a method that returns the number of 'increasing' characters at the start of string 'str'. To be increasing characters, each successive character must have a higher UNICODE value than the previous character. For example, in "abdfjknz" ALL characters are in increasing character order since the UNICODE for 'b' is greater than the UNICODE for 'a'; the UNICODE for 'd' is greater than the UNICODE for 'b', etc. Suggestion: Use the charAt method! Remember: This is looking for the number of increasing characters starting at the beginning of the string. This is NOT looking for the longest sequence of increasing character starting anywhere. It IS looking for the longest sequence of increasing characters, starting at the beginning of the string. Hint: When you compare characters with the "<" or ">" comparison, it automatically compares their UNICODE values! Another hint: Look at the test data for examples!


quiz2023_04_25_SLHL_countAscending("") → 0
quiz2023_04_25_SLHL_countAscending("A") → 1
quiz2023_04_25_SLHL_countAscending("Z") → 1

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

public int quiz2023_04_25_SLHL_countAscending(String str) { }

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: 240

Copyright Nick Parlante 2017 - privacy