From cbad207456cb2cd579f9b4121816456c12ab3bce Mon Sep 17 00:00:00 2001 From: Cara Krug Date: Sat, 9 Oct 2021 19:20:32 -0500 Subject: [PATCH] Birthday problem --- Basic Codes/Birthday.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 Basic Codes/Birthday.java diff --git a/Basic Codes/Birthday.java b/Basic Codes/Birthday.java new file mode 100644 index 0000000..ffc11d0 --- /dev/null +++ b/Basic Codes/Birthday.java @@ -0,0 +1,12 @@ +//Birthday Paradox problem +class HBD { + static double find(double p) { + return Math.ceil(Math.sqrt(2 * 365 * Math.log(1 / (1 - p)))); + } + + //Driver + public static void main(String[] args){ + + System.out.println(find(0.70)); + } +} \ No newline at end of file