diff options
| author | Mohammad S Anwar <Mohammad.Anwar@yahoo.com> | 2022-06-24 20:03:07 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-06-24 20:03:07 +0100 |
| commit | 1f924ef4e04df43125bbce94275506fe0f270602 (patch) | |
| tree | 6ab843963838e1a87a44e317c239773eedc1a3dd | |
| parent | 242265f36e6c6d41b3996a25891c805b355f5bb7 (diff) | |
| parent | 4ba0faeb5ff6aaf9a29299bebeb6fd7dc8f0b4e6 (diff) | |
| download | perlweeklychallenge-club-1f924ef4e04df43125bbce94275506fe0f270602.tar.gz perlweeklychallenge-club-1f924ef4e04df43125bbce94275506fe0f270602.tar.bz2 perlweeklychallenge-club-1f924ef4e04df43125bbce94275506fe0f270602.zip | |
Merge pull request #6331 from pokgopun/pwc142
add more test case for ch-1 where m is a square and fix bug
| -rw-r--r-- | challenge-142/pokgopun/go/dldcount/dldcount.go | 3 | ||||
| -rw-r--r-- | challenge-142/pokgopun/go/dldcount/dldcount_test.go | 1 |
2 files changed, 4 insertions, 0 deletions
diff --git a/challenge-142/pokgopun/go/dldcount/dldcount.go b/challenge-142/pokgopun/go/dldcount/dldcount.go index 2a1088aac2..e4ee7467f1 100644 --- a/challenge-142/pokgopun/go/dldcount/dldcount.go +++ b/challenge-142/pokgopun/go/dldcount/dldcount.go @@ -15,6 +15,9 @@ func Count(m, n uint) (c uint) { if v%10 == n { c++ } + if d == m/d { + break + } } } } diff --git a/challenge-142/pokgopun/go/dldcount/dldcount_test.go b/challenge-142/pokgopun/go/dldcount/dldcount_test.go index fcab676796..8189b1127c 100644 --- a/challenge-142/pokgopun/go/dldcount/dldcount_test.go +++ b/challenge-142/pokgopun/go/dldcount/dldcount_test.go @@ -12,6 +12,7 @@ func TestDldCount(t *testing.T) { {30, 5, 2}, {30, 0, 1}, {30, 6, 1}, + {64, 8, 1}, } for _, d := range data { res := Count(d.m, d.n) |
