CodeWars:Most digits
来源:互联网 发布:udp监听端口阻塞 编辑:程序博客网 时间:2024/06/05 19:59
题目:
我的解:
public class Kata{ public static int FindLongest(int[] number) { // code here int max = number[0], maxIndex = number[0].ToString().Length; for (int i = 1; i < number.Length; i++) { if (max < number[i] && maxIndex != number[i].ToString().Length) { max = number[i]; maxIndex = number[i].ToString().Length; } else continue; } return max; }}
多种答案之一:
using System.Linq;public class Kata{ public static int FindLongest(int[] N) { return N.OrderByDescending(X => X.ToString().Length).First(); }}
阅读全文
0 0
- CodeWars:Most digits
- [Haskell] CodeWars|Sum of Digits
- Codewars解题Playing with digits
- daily CodeWars
- Part2.CodeWars
- codewars day1
- 【codewars】Mumbling
- MOST
- most
- checkio的一些题:Speech Module,Feed Pigeons,Roman numerals,Golden Pyramid,The Most Numbers,Digits Multipl
- codewars - Broken Greetings
- CodeWars——js
- CodeWars---Python第二题
- CodeWars---Python第三题
- CodeWars---Python第四题
- Codewars 9月刷题
- 【Codewars-hamming(汉明数)】
- LeetCode & Codewars 食用口感
- Gym 101243.C
- 思科模拟器的下载
- Hololens开发之HoloLens简介
- 微信小程序 —— button按钮去除border边框
- 第三周项目2-建设“顺序表”算法库
- CodeWars:Most digits
- HDPCD-Java-复习笔记(5)
- WiFi热点数据传输DEMO
- 常见空指针异常及其避免
- AnjularJS-imooc学习笔记1
- C# WEBREQUEST简单调用WEBSERVICE方法
- Spring Boot 形参Map并没有添加到类似于ModelAndView中,但是却可以页面取到相应的值?
- Gym 101243.E
- 【kmp算法】数据结构实验之串三:KMP应用