Get the minimum number of two segments

Time:2021-12-8

Problem surface

An arbitrary positive integer n, find the minimum number of two segments larger than N and a multiple of n

A binary number is a positive integer that contains exactly two different decimal numbers s and T, s is not 0, and all occurrences of s are arranged in front of all t

For example, 4411 is a two segment number (s is 4, t is 1), and so are 41, 10000000, and 555556.

But 44114 and 44444 are not two segment numbers.

analysis

  1. Number of regular judgment segments
  2. Multiple find minimum jump loop

code

import re

output

(base) D:\code-base\python\test>python -u "d:\code-base\python\test\bin2.py"
1
2019
0
1: 10
2019: 9999999993

This work adoptsCC agreement, reprint must indicate the author and the link to this article

Recommended Today

Heavyweight Tencent cloud open source industry’s first etcd one-stop governance platform kstone

​ Kstone open source At the kubecon China Conference held by CNCF cloud native foundation on December 9, 2021,Tencent cloud container tke team released the open source project of kstone etcd governance platform. KstoneIt was initiated by the TKE team of Tencent cloud containerCloud native one-stop etcd governance project based on kubernetes。 The project originates […]