[codewars] TripleDouble

这篇博客讨论了 Codewars 上的一个编程挑战 'TripleDouble'。内容涉及到编写一个函数,该函数检查输入的两个数字数组中是否存在连续的三个相同数字(triple)以及连续的两个相同数字(double),并且这两个序列包含相同的数字。文章提供了作者的实现代码以及一个更巧妙的解决方案。
摘要由CSDN通过智能技术生成

题目:

Write a function

TripleDouble(long num1, long num2)

which takes numbers num1 and num2 and returns 1 if there is a straight triple of a number at any place in num1 and also a straight double of the same number in num2.

If this isn't the case, return 0

Examples

TripleDouble(451999277, 41177722899) == 1 // num1 has straight triple 999s and 
                                          // num2 has straight double 99s

TripleDouble(1222345, 12345) == 0 // num1 has straight triple 2s but num2 has only a single 2

TripleDouble(12345, 12345) == 0

TripleDouble(666789, 12345667) == 1

my code:

package my;

public class Kata
{
	  private static String temp ;
	  public
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值