Skip to content

Instantly share code, notes, and snippets.

@chase-lambert
Created May 17, 2023 00:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chase-lambert/2f4e3040067065b368d1bc69a441080f to your computer and use it in GitHub Desktop.
Save chase-lambert/2f4e3040067065b368d1bc69a441080f to your computer and use it in GitHub Desktop.
rendezvous with cassidoo challenge: 23.05.14
pub fn binary_pal(n: i32) -> bool {
let s = format!("{n:b}");
s == s.chars().rev().collect::<String>()
}
#[test]
fn binary_pal_test() {
assert_eq!(binary_pal(5), true);
assert_eq!(binary_pal(10), false);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment