上回邀請朋友一起來進行 pair programming,隨機挑了一個 Codewars 的題目來練習:Mumbling。
題目描述:
上回邀請朋友一起來進行 pair programming,隨機挑了一個 Codewars 的題目來練習:Mumbling。
題目描述:
Codewars 上隨機挑到的題目:Number of People in the Bus
Codewars 上隨機挑到的一個題目:Buying A Car
Codewars 上的 kata: Next bigger number with the same digits
You have to create a function that takes a positive integer number and returns the next bigger number formed by the same digits:
f(12) == 21
f(513) == 531
f(2017) == 2071If no bigger number can be composed using those digits, return -1:
f(9) == -1
f(111) == -1
f(531) == -1
用 TDD 來練習完成 leet code 的第 219 題,題目描述如下。
Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j] and the absolute difference between i and j is at most k.