Character Case sort

Source: Internet
Author: User

Title Description: Given a string containing only letters, sort in the order of uppercase letters followed by lowercase letters.

Example: Give "ABACD", one possible answer is "Acbad"

The color of the row with the title (see: Click to open the link) is the same. (Amount ... I don't know why the same problem he would make so much of, so I don't talk anymore. is to put the lowercase all in front of the array by swapping. The code is below:

Class solution: "" "    @param chars:the Letters array you should sort.    " " def sortletters (self, chars): Left        =-1        n = len (chars) for        i in range (n):            if Chars[i].islower (): Left                + = 1                chars[i], chars[left] = Chars[left], chars[i]        return chars        # write your code here


Character Case sort

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.