Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6573345
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:07:14+00:00 2026-05-25T15:07:14+00:00

Input: BDCAbaxz OUTPUT: AaBbCDxz My solution is straight forward and ugly: Sort the input

  • 0

Input: BDCAbaxz

OUTPUT: AaBbCDxz

My solution is straight forward and ugly:

  1. Sort the input with quick sort, then we get “ABCDabxz”

  2. Alloc a temp array with the same size as the original one, then take the appropriate element from two sub-array(ptr1–>A, ptr2—>a)

  3. Copy the temp array back to the original one

Any faster algorithm on this problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T15:07:14+00:00Added an answer on May 25, 2026 at 3:07 pm

    Yes.

    Define a comparator for qsort that gives you the ordering you want in the first place (so rather than using AB...YZab...yz as the sort order, have it enforce AaBb...YyZz).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Input : {5, 13, 6, 5, 13, 7, 8, 6, 5} Output : {5,
Input: SHC 111U,SHB 22x,, SHA 5555G Needed output: SHB 22X, SHC 111U, SHA 5555G
Input: I have a LaTeX file, with plain text & math formulas. Desired output:
Input col1, col2, col3, coln Output @col1, @col2, @col3, @coln
As input I get an int (well, actually a string I should convert to
Input: var str = 'text {{value1}} text {{value2}}text{{value1}}'; Regex: var result = str.match(/({{\S+}})+/ig); Output:
Input: Hi. I am John. My name is John. Who are you ? Output:
input: name <hui.li@xxx.ch>; hans@dhdfhgdfgh <hans.dampf@xxxx>; Output: e1@mail.com, e2@mail.com, e3@mail.com,e@mail.com I want to erase the
Input String: 115.0000 Output String should be like: 115.00 i used this code: String.format(%.2f,115.0000);
input: ['abc', 'cab', 'cafe', 'face', 'goo'] output: [['abc', 'cab'], ['cafe', 'face'], ['goo']] The problem

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.