![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
编程练习
小皮皮瓜
这个作者很懒,什么都没留下…
展开
-
输出最后一个字符串的长度
链接:https://www.nowcoder.com/questionTerminal/8c949ea5f36f422594b306a2300315da来源:牛客网计算字符串最后一个单词的长度,单词以空格隔开。输入描述:一行字符串,非空,长度小于5000。输出描述:整数N,最后一个单词的长度。输入例子:hello world输出原创 2017-04-07 15:13:22 · 617 阅读 · 0 评论 -
Reshape the Matrix
题目描述:In MATLAB, there is a very useful function called 'reshape', which can reshape a matrix into a new one with different size but keep its original data.You're given a matrix represented b原创 2017-05-09 20:09:27 · 390 阅读 · 0 评论 -
Distribute Candies
描述:Given an integer array with even length, where different numbers in this array represent different kinds of candies. Each number means one candy of the corresponding kind. You need to distrib原创 2017-05-09 19:30:40 · 304 阅读 · 0 评论 -
Hamming Distance
题目描述:The Hamming distance between two integers is the number of positions at which the corresponding bits are different.Given two integers x and y, calculate the Hamming distance.Not原创 2017-05-09 18:55:49 · 254 阅读 · 0 评论 -
Reverse String
Write a function that takes a string as input and returns the string reversed.Example:Given s = "hello", return "olleh".Subscribe to see which companies asked this question.点击打开链接简原创 2017-05-17 14:11:37 · 146 阅读 · 0 评论 -
Array Partition I
Given an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1, b1), (a2, b2), ..., (an, bn) which makes sum of min(ai, bi) for all i from 1 to n as large a原创 2017-05-08 16:25:11 · 219 阅读 · 1 评论 -
Fizz Buzz
Write a program that outputs the string representation of numbers from 1 to n.But for multiples of three it should output “Fizz” instead of the number and for the multiples of five output “Buzz”.原创 2017-05-16 13:08:18 · 240 阅读 · 0 评论 -
Keyboard Row
Given a List of words, return the words that can be typed using letters of alphabet on only one row's of American keyboard like the image below.Example 1:Input: ["Hello", "Alaska", "Da原创 2017-05-15 23:32:45 · 195 阅读 · 0 评论 -
Longest Substring Without Repeating Characters
Given a string, find the length of the longest substring without repeating characters.Examples:Given "abcabcbb", the answer is "abc", which the length is 3.Given "bbbbb", the answer is "原创 2017-05-05 15:42:38 · 138 阅读 · 0 评论 -
Number Complement
Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation.Note:The given integer is guaranteed to fit within the range of原创 2017-05-11 10:39:44 · 156 阅读 · 0 评论 -
Add Two Numbers
题目描述:You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers a原创 2017-05-01 21:58:22 · 164 阅读 · 0 评论 -
Two Sum
题目描述:Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution, and you may not us原创 2017-04-29 22:47:42 · 134 阅读 · 0 评论 -
进制转换
题目链接:https://www.nowcoder.com/practice/8f3df50d2b9043208c5eed283d1d4da6?tpId=37&tqId=21228&tPage=1&rp=&ru=/ta/huawei&qru=/ta/huawei/question-ranking题目描述写出一个程序,接受一个十六进制的数值字符串,输出该数值的十进制字符串。(原创 2017-04-08 14:48:32 · 186 阅读 · 0 评论 -
字符串分隔
题目链接:https://www.nowcoder.com/practice/d9162298cb5a437aad722fccccaae8a7?tpId=37&tqId=21227&rp=0&ru=/ta/huawei&qru=/ta/huawei/question-ranking题目描述•连续输入字符串,请按长度为8拆分每个字符串后输出到新的字符串数组;•长度不是8整数倍原创 2017-04-07 17:23:52 · 165 阅读 · 0 评论 -
明明的随机数
题目链接:https://www.nowcoder.com/practice/3245215fffb84b7b81285493eae92ff0?tpId=37&tqId=21226&rp=0&ru=/ta/huawei&qru=/ta/huawei/question-ranking题目描述明明想在学校中请一些同学一起做一项问卷调查,为了实验的客观性,他先用计算机生成了N个1到1原创 2017-04-07 16:42:56 · 273 阅读 · 0 评论 -
计算字符个数
题目描述写出一个程序,接受一个有字母和数字以及空格组成的字符串,和一个字符,然后输出输入字符串中含有该字符的个数。不区分大小写。输入描述:输入一个有字母和数字以及空格组成的字符串,和一个字符。输出描述:输出输入字符串中含有该字符的个数。输入例子:ABCDEFA输出例子:1import java.util.Sc原创 2017-04-07 16:06:14 · 174 阅读 · 0 评论 -
Reverse Words in a String III
题目描述:Given a string, you need to reverse the order of characters in each word within a sentence while still preserving whitespace and initial word order.Example 1:Input: "Let's take Leet原创 2017-05-10 10:17:46 · 208 阅读 · 0 评论