Ryan is an engineer in the Sacramento Area with a focus in Python, Ruby, and Rust. Bash/Python Exercism mentor. Coding, physics, calculus, music, woodworking. Looking for work!
My motto for today is: it's not stupid if it works. I didn't feel like fighting with Rust over "whose characters belong to whom" and "you can't borrow that" and "don't add strings together". Don't judge me.
/// Day 4: Secure Container/// /// Crack the password to a Venus fuel containerfngenerate_passwords()->Vec<usize>{letmutresults:Vec<usize>=Vec::new();forain1..=6{forbin0..=9{forcin0..=9{fordin0..=9{forein0..=9{forfin0..=9{letnum=a*100000+b*10000+c*1000+d*100+e*10+f;ifnum<134792||num>675810{continue;}ifa!=b&&b!=c&&c!=d&&d!=e&&e!=f{continue;}ifa>b||b>c||c>d||d>e||e>f{continue;}results.push(num);}}}}}}results}fngenerate_passwords2()->Vec<usize>{letmutresults:Vec<usize>=Vec::new();forain1..=6{forbin0..=9{forcin0..=9{fordin0..=9{forein0..=9{forfin0..=9{letnum=a*100000+b*10000+c*1000+d*100+e*10+f;ifnum<134792||num>675810{continue;}if!((a==b&&b!=c)||(b==c&&a!=b&&c!=d)||(c==d&&b!=c&&d!=e)||(d==e&&c!=d&&e!=f)||(e==f&&d!=e)){continue;}ifa>b||b>c||c>d||d>e||e>f{continue;}results.push(num);}}}}}}results}pubfnrun(){letcandidates=generate_passwords();println!("There are {} possible passwords.",candidates.len());letcandidates2=generate_passwords2();println!("For round 2, there are {} possible passwords.",candidates2.len());}
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
My motto for today is: it's not stupid if it works. I didn't feel like fighting with Rust over "whose characters belong to whom" and "you can't borrow that" and "don't add strings together". Don't judge me.