[Huawei machine trial exercise] 50. Calculate the last three digits of M to the power of Npower, and the power of Huawei
Question
Description:
The Npower of a positive integer M may be a very large number. We only need to calculate the last three digits of this number. For example, if the values of input 5 and 3 are 125, the output value is 125 for example 2. For example, if the value of 10 in input 2 a
[Huawei exercises] decomposing strings, Huawei exercises decomposing strings
Question
Break down the string as required. Input two numbers M, N; M represents the input M string, N represents the number of digits of each string output, not enough to add 0. For example, if you enter 123456789, "abc", and "12345678", the output is "abc00000", "90000000"
Code
/* ----------------------------------- * Date: 2015
June 12, the latest version of Sohu News app is officially launched in Huawei Application Market!So, what are the highlights of this version of the Sohu news app?Let's take a picture and feel it directly--?Blur the picture, instantly clear!Effect on the bar.and hidden behind this divine operation,Huawei Hiai Engine's image super-resolution capability.Photos processed by
Huawei trial-search for the number of substrings and Huawei for the number of substrings
Enter a string to determine the number of substrings.
Input: asdg ds dga
Output: 3
# Include
Huawei trial-subtraction of large numbers, Huawei large numbers
Question: subtraction of large numbers
Enter a positive integer of two strings. The first line is the subtrahend, the second line is the subtrahend, and the result of the first line minus the second line is output.
Note: 1. Both integers are positive integers. The subtrahend are greater than the subtrahend. Example:
Input: 1000000000000001 1
Huawei trial-outputs a single digit and a single digit, While Huawei outputs a single digit
Two solutions:
1. Add one by one
# Include
2. Convert to string Addition
# Include
Huawei test-Child string separation and Huawei string SeparationDescription:Input any string sequence through the keyboard. The string may contain multiple substrings separated by spaces. Compile a program to automatically separate the substrings and separate them with commas (,). At the end, add a comma (,) and store the substrings.If "abc def gh I d" is input, the result will be abc, def, gh, I, d,Require
Huawei trial-difference sorting, Huawei difference sorting
Sorts the integer array by the difference value from the specified integer and returns the result in ascending order of the difference value.
Implementation Method:
Public staticint [] calcTimes (int [] num, int value );
[Input] num: an integer array;
Integer specified by value
[Return] returns an integer array in ascending order, sorted by the di
Huawei machine trial-same sub-string, Huawei Machine
Enter a string to check whether the string contains the same substring (the string length is greater than 1). The value is output 1, no, and output 0.
For example, 12312 contains two 12 s, so output 1; 23456 does not have the same subsequence, and output 0.Input: 12312
Output: 1
# Include
Test data:
12312
Test results:
Huawei trial-word count, Huawei word count
Enter an article, and output the words with the highest frequency and the secondary frequency (all in lower case, separated by commas ). Only the space, comma, and period delimiters are displayed in the article.
Regardless of the frequency. Case Insensitive.
Input: I am a student. I come from XiDian, I love XiDian.
Output: I, xidian
#include
Huawei machine trial-string de-sequencing, Huawei machine string sorting
Enter a string, remove the repeated characters, and sort the remaining strings.
# Include Test data:
Dfsfsf3345s
Test results:
Huawei trial-output number containing "23", Huawei 23
Enter a row of numbers: 123 423 5645 875 186523In the input second line: 23Output and sort the number containing "23" in the second row in the first row
Result: 123 423 186523
/* Sort and traverse each number sequentially to see if 23 */# include
Test data:
123 423 5645 875 186523
23
Test results:
Huawei trial-replace letters in strings with Huawei strings
Function Description: replace all the letters in a string with the next letter. If the last character is z or Z, replace it with A or.
* Input: aBxyZ
* Output: bCyzA
# Include
Huawei trial-converts the initial character string to uppercase, and Huawei capitalExample:Input: this is a book
Return Value: This Is A Book
# Include
Question about the number of matching brackets in Huawei OJ training, Huawei oj
The questions are as follows:
Parentheses matching
Input n parentheses and output n parentheses that can be combined. For example --
Only () is input;
When the input is 2, there are two types: () and;
When 3 is input, there are (), () and ((())), five types.
There are 14 input values .. And so on.
I think of stupid methods, an
Huawei recruitment testing 7: an array of input [], Huawei inputHuawei recruitment testing 7: an array of input []
Question: Give an array intput []If the array length n is an odd number, place the largest element in the array in the middle of the output [] array. If the array length n is an even number, place the largest element in the array to the right of the two locations in the middle of the output []
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.