given a word, print its index, words can be increased accordingly

前端 未结 5 1612
南方客
南方客 2021-02-04 06:26

Imagine an alphabet of words.

Example:

 a ==> 1 
 b ==> 2 
 c ==> 3 

 z ==> 26 
 ab ==> 27 
 ac ==> 28 

 az ==> 51 
 bc ==> 52         


        
5条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-04 06:35

    This is a combination of two problems: parsing a number in a base that isn't 10 and determining if input is sorted.

    Note that, since this is probably homework, you probably can't just use existing methods to do the hard work.

提交回复
热议问题