Huawei computer interview Test

Source: Internet
Author: User

I went to Huawei for another interview and added a question for the computer examination.

It was a big surprise for me to regard Huawei interview as a software proficiency test.

Okay. Now let's talk about the computer examination:

1. First, enter your name and mobile phone number on their computer examination page (this is also the first of Huawei s and is convenient for candidates who have excellent scores directly :))

2. download their machine test code. A simple project contains an unimplemented function and function description.

3. You implement this function, debug the program, and then package it into a zip file for upload.

The problem I encountered was as follows:

A character string contains space character characters with random positions. All non-space characters in the character string should be found, and spaces should be replaced.

There must be a ',' At the end of the replaced sentence.

For example, the result after "This Is An Demo" is replaced is:

"This, is, an, demo ,"

 

Is the question very simple? In fact, there are still many "points" in this question. If you do not think about it at all, your score will be affected.

Now I will introduce the implemented functions:

 

Void replacestring (char * pinstring, int ileng, char * poutstring) // (poutstring is assumed to be long enough memory and imported from outside)

{

* Poutstring = "/0 ";

While (* pInString = '') // jump space character that occur at start.

PInString ++;

 

Char * ptOutString = pOutString;

While (* pInStirng)

{

* PtOutString = * pInString;

PtOutString ++;

PInString ++;

 

If (* pInString = '')

{

* PtOutString = ',';

PtOutString ++;

}

While (* pInString & * pInString = '')

PInString ++;

 

}

 

* PtOutString = '/0 ';

If (pOutString [0]! = '/0' & * (ptOutString-1 )! = ',')

{

 

* PtOutString = ',';

* (++ PtOutString) = '/0 ';

}

 

}

 

Well, this is the perfect answer. You can write it yourself and refer to it.

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.