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
void AddOrUpdateQuote(IQuote quote) | |
{ | |
if(quote?.Id != null && quoteMap.containsKey(quote.Id) && !quote.equals(quoteMap[quote.Id])) | |
{ | |
existingquote = quoteMap[quote.Id]; | |
existingquote.Price = quote.Price; | |
existingquote.AvailableVolume = quote.AvailableVolume; | |
... | |
this.BookLookupTable[quote.Symbol].sort() |
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
class IntervalComparator implements Comparator<Interval> { | |
@Override | |
public int compare(Interval i1, Interval i2) { | |
return i1.start == i2.start ? Long.compare(i1.end, i2.end) : Long.compare(i1.start, i2.start); | |
} | |
} |
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
ArrayList<Interval> getFreeList(long start, long end, ArrayList<ArrayList<Interval>> busyLists) { | |
ArrayList<Interval> result = new ArrayList<>(); | |
if (start >= end) return result; | |
if (busyLists.size() == 0) { | |
result.add(new Interval(start, end)); | |
return result; | |
} | |
ArrayList<Interval> globalList = new ArrayList<>(); |
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 java.io.*; | |
import java.util.*; | |
import java.text.*; | |
import java.math.*; | |
import java.util.regex.*; | |
public class Solution { | |
public static int INF = Integer.MAX_VALUE >> 2; | |
public static void main(String[] args) { |
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 java.io.*; | |
import java.util.*; | |
import java.text.*; | |
import java.math.*; | |
import java.util.regex.*; | |
public class Solution { | |
public static int INF = Integer.MAX_VALUE >> 2; | |
public static void main(String[] args) { |
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 java.io.*; | |
import java.util.*; | |
import java.text.*; | |
import java.math.*; | |
import java.util.regex.*; | |
public class Solution { | |
public static int INF = Integer.MAX_VALUE >> 2; | |
public static void main(String[] args) { |
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 java.io.*; | |
import java.util.*; | |
import java.text.*; | |
import java.math.*; | |
import java.util.regex.*; | |
public class Solution { | |
public static int INF = Integer.MAX_VALUE >> 2; | |
public static int int_hash(int key) { |
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
#include <cstdio> | |
#include <vector> | |
#include <iostream> | |
#include <algorithm> | |
#include <climits> | |
#include <unordered_set> | |
#include <list> | |
#include <queue> | |
using namespace std; |
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
class Solution { | |
public: | |
bool isMatch(const char *s, const char *p) { | |
int s_size = strlen(s); | |
int p_size = strlen(p); | |
vector<vector<int>> dict(s_size + 1, vector<int>(p_size + 1, -1)); | |
is_match(s, p, 0, 0, dict); | |
return dict[0][0] ? true : false; | |
} | |
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
class Solution { | |
public: | |
int search(int A[], int n, int target) { | |
return bsearch(A, 0, n - 1, target); | |
} | |
int bsearch(int A[], int l, int u, int target) { | |
if (l > u) { | |
return -1; | |
} |
NewerOlder