Skip to content

felds/bfs-study

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bfs Study

It solves for the problem:

Given a positive integer N, find the smallest number of steps it will take to
reach 1.

There are two kinds of permitted steps:
- You may decrement N to N - 1.
- If a * b = N, you may decrement N to the larger of a and b.

For example, given 100, you can reach 1 in five steps with the following route:
100 -> 10 -> 9 -> 3 -> 2 -> 1.

To run:

bun run index.ts

To test:

bun test

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors