From 36f9a2e58f6d2a9785fc50603fa78ada27d6b2d1 Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Fri, 13 Sep 2024 15:10:28 -0400 Subject: [PATCH] Fixes the pseudo code --- 76.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/76.md b/76.md index 408cb313..10f7cd4d 100644 --- a/76.md +++ b/76.md @@ -61,11 +61,13 @@ class BloomFilter(size: Int, rounds: Int, buffer: ByteArray) { return true } - fun encode() = size + ":" + rounds + ":" + base64Enc(bits.toByteArray()) // base64 might include extra 0 bits to fill the last byte + fun encode() { + return size + ":" + rounds + ":" + base64Encode(bits.toByteArray()) + } fun decode(str: String): BloomFilter { val parts = str.split(":") - return BloomFilter(parts[0].toInt(), parts[1].toInt(), base64Decode(bits.toByteArray())) + return BloomFilter(parts[0].toInt(), parts[1].toInt(), base64Decode(parts[2])) } } ```