Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solution for 1. right propagate rightmost set bit and 2. is power of 2 #231

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,6 @@ After installing CMake, open your terminal, go to `epi_judge_cpp` folder and run

Then just open `epi_judge_cpp/vs/epi_judge_cpp.sln` solution with Visual Studio and it will load all EPI programs.

## Tracking your progress

The file [index.html](https://github.com/adnanaziz/EPIJudge/blob/master/index.html) in the root of this project tracks your progress through the problems. Specifically, there's an expanding tab for each chapter. Click on it, and you will see your progress, e.g., as below. This file gets updated each time you execute a program. You can **use this file to map book problems to stub programs**.

<img src="https://i.imgur.com/xjf7Z32.png" width="600px"></img>

## Acknowledgments

A big shout-out to the hundreds of users who tried out the release over the past couple of months. As always, we never fail to be impressed by the enthusiasm and commitment our readers have; it has served to bring out the best in us.
Expand Down
17 changes: 17 additions & 0 deletions epi_judge_java_solutions/epi/PrimitiveTypes.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package epi;

public class PrimitiveTypes {
public int rightPropagateRightMostSetBit(int x){
return x | (x - 1);
}
public boolean isPowerOfTwo(long x){
return (x & (x - 1)) == 0;
}
}

class TDPrimitiveTypes{
public static void main(String[] args) {
System.out.println(new PrimitiveTypes().isPowerOfTwo(64));
System.out.println(new PrimitiveTypes().rightPropagateRightMostSetBit(64));
}
}