Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C 

Attempting to solve a hackerrank problem (Huffman)

Hey there, I'm attempting to solve a hackerrank problem and I've gotten to a point where I'm getting 4/7 test cases that are succeeding and the test cases are that are failing don't really let you debug why its failing. I'm assuming that my code may be missing some edge cases but I can't seem to figure whats wrong with it. Also I'm attempting to solve the problem with C++, even though I am more familiar to C# so I may be prone to a logic error that I don't know of that works differently between these two languages.

Anyhow, the problem has to do with Huffman Encoding/Decoding. Here is a sample on how the input/output should work.
i.gyazo.com/734fe0907524dd48ca3316695e436ca4(dot)png - I can't post links :<

They give you a string function to fill out, and they give you the following parameters: codes (in a vector array), and the encoded string. That string should return the decoded message like the sample above.

Here's my code: Pastebin(dot)com/ -> 4qmsjtEn - I can't post links :<
Hackerrank just gives you the "string decode(vector<string> codes, string encoded)" function.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Python] by AzythumAug 2, 2024 10:19 AM 3 187 Aug 2, 2024 10:19 AM
Last Post: Perlo
[C] by kakarot007Apr 19, 2019 12:17 PM 0 264 Apr 19, 2019 12:17 PM
Last Post: kakarot007
[Java] by LoGiuratoMar 2, 2018 01:30 PM 1 217 Mar 2, 2018 01:30 PM
Last Post: LoGiurato