This file contains hidden or 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
private static int equalizeArray(int[] arr) { | |
int[] index = new int[101]; | |
int[] intrinsicIndex = new int[101]; | |
int max = 0; | |
for (int i = 0; i < arr.length; i++) { | |
index[arr[i]]++; | |
} | |
//Select only Non-Zero integers |
This file contains hidden or 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
static String getStatusOfDoctorOpenedOrClosed(int[] doctorDays, int[] fromHour, int[] toHour) { | |
String opened = "Opened: Closes at 8 PM"; | |
String closed = "Closed: Opens at Mon 4 PM"; | |
int doctorWeekLength = doctorDays.length; | |
//Get Exact day of the week | |
Date date = new Date(); | |
LocalDate localDate = date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); | |
int dayOfWeek = localDate.getDayOfWeek().getValue() + 1; |
This file contains hidden or 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
##Fetch changes from remote repository to local machine | |
#Reference a remote repository locally under name 'upstream' | |
- git remote add upstream <link> | |
#De-reference a remote repository locally under name 'upstream' | |
- git remote rm upstream | |
#Fetch the new changes from upstream | |
- git fetch upstream |
This file contains hidden or 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
#include <iostream> | |
#include <bits/stdc++.h> | |
using namespace std; | |
char mPlayer = 'x'; | |
int change = 0; | |
int position; | |
int pairPosition; | |
int round_num; |
This file contains hidden or 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 Solution { | |
private static int change; | |
private static int mIndex; | |
private static int mSubIndex; | |
private static int round; | |
private static boolean isMyTurn; | |
private static StringBuilder current, winner; | |
private static char player1 = 'x'; | |
private static char player2 = 'x'; |
This file contains hidden or 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 firebase functions modules | |
const functions = require('firebase-functions'); | |
//import admin module | |
const admin = require('firebase-admin'); | |
admin.initializeApp(functions.config().firebase); | |
// Listens for new messages added to messages/:pushId | |
exports.notificationSender = functions.database.ref('/messages/{pushId}').onWrite((change,context) => { |
This file contains hidden or 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
#include <iostream> | |
#include <vector> | |
#include <deque> | |
using namespace std; | |
deque<int> addDeques(deque<int>& num1, deque<int>& num2); | |
int main() | |
{ |
This file contains hidden or 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
#include <iostream> | |
#include <iomanip> | |
using namespace std; | |
int gcd(int a, int b); | |
long double lcm (long a, long b); | |
int main() | |
{ |
This file contains hidden or 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
DatabaseReference testRef = mRef.child("test"); | |
testRef.addValueEventListener(new ValueEventListener() { | |
@Override | |
public void onDataChange(@NonNull DataSnapshot dataSnapshot) { | |
for (DataSnapshot db : dataSnapshot.getChildren()){ | |
db.child("isAvailable").getRef().setValue(null); | |
} | |
} |
This file contains hidden or 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
DatabaseReference testRef = mRef.child("test"); | |
ref.runTransaction(new Transaction.Handler() { | |
@Override | |
public Transaction.Result doTransaction(MutableData currentData) { | |
currentData.child("my new child").setValue(1); | |
return Transaction.success(currentData); | |
} | |
@Override | |
public void onComplete(FirebaseError firebaseError, boolean committed, DataSnapshot currentData) { |
NewerOlder