This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TwoPolitician { | |
public static class Pair { | |
String follower; | |
String following; | |
public Pair(String follower, String following) { | |
this.follower = follower; | |
this.following = following; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Bubble sort algorithm. | |
* Time complexity: O(n*n) | |
* Space complexity: O(1) | |
*/ | |
static int[] bubbleSort(int[] A) { | |
for (int i = 0; i < A.length; i++) { | |
for (int j = 0; j < A.length - 1 ; j++) { | |
if (A[j] > A[j + 1]) { | |
int temp = A[j + 1]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Find element position in sorted int array using binary search. | |
* Time- O(long n) Space- C | |
*/ | |
static int binSearch(int[] A, int k) { | |
int l = 0; | |
int u = A.length - 1; | |
int m; | |
while (l <= u) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DemoActivity extends Activity implements LoaderManager.LoaderCallbacks<T> { | |
private static final int LOADER_ID = 1; | |
public void onCreate(Bundle savedInstanceState) { | |
getLoaderManager().initLoader() | |
} | |
public Loader<T> onCreateLoader(Loader<T> loader, T data) { | |
// Create the loader | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dependencies { | |
compile 'com.parse.bolts:bolts-tasks:1.3.0' | |
paidCompile 'com.android.support:design:23.1.1' | |
freeCompile 'com.parse:parse-android:1.12.0' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
android.variantFilter { variant -> | |
if(variant.buildType.name.equals('release') | |
&& variant.getFlavors().get(0).name.equals('mock')) { | |
variant.setIgnore(true); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
productFlavors { | |
free { | |
} | |
paid { | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin: 'com.android.application' | |
android { | |
compileSdkVersion 23 | |
buildToolsVersion "23.0.1" | |
defaultConfig { | |
applicationId "com.example.pf" | |
minSdkVersion 15 | |
targetSdkVersion 23 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.os.Parcel; | |
import android.os.Parcelable; | |
/** | |
* Parcelable Doa class. To pass onject from one activity to another | |
* via Intent | |
*/ | |
public class DaoClass implements Parcelable { | |
String data1; | |
String data2; |