Here are the solutions in C++ and Java in the order in which they appear in Release 1.4. Click here for solutions ordered alphabetically by problem name.
Here is the Java codebase organized as a Maven project.
We'd love to link your solutions, so if you have code you'd like to share with us, please send us a link to your public repo (github/bitbucket/etc.) or the code itself. We'll attribute it suitably.
Compute parity
Parity1.h Parity1.java Parity2.h Parity2.java Parity3.h Parity3.java Parity4.h Parity4.java
Swap bits
swap_bits.h SwapBits.java
Reverse bits
Reverse_bits.cpp ReverseBits.java
Find a closest integer with the same weight
Closest_int_same_bits.cpp ClosestIntSameBits.java
Compute x * y without multiply or add
MultiplyShiftAdd.cpp MultiplyShiftAdd.java
Compute x/y
Division.cpp Division.java
Compute x^y
power-x-y.cc PowerXY.java
Convert base
Convert_base.cpp ConvertBase.java
Compute the spreadsheet column encoding
Spreadsheet_encoding.cpp SpreadsheetEncoding.java
Reverse digits
Read full article from Solutions - Elements of Programming Interviews
No comments:
Post a Comment