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: | |
ListNode* mergeKLists(vector<ListNode*>& lists) { | |
vector<ListNode*> allNodes; | |
vector<int> integers; | |
for(auto& element : lists) { | |
while(element != nullptr) { | |
allNodes.push_back(element); | |
integers.push_back(element->val); | |
element = element->next; |
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
module sync_counter_1bit_pn (input up,dn,clk,rst,output reg q,output wire next_up,next_dn); | |
wire nq,prev; | |
not(nq,q); | |
or(prev,up,dn); | |
and(next_up,up,q); | |
and(next_dn,dn,nq); | |
initial q <= 1'b0; | |
always @(posedge clk or negedge rst) begin | |
if(!rst) begin | |
q <= 1'b0; |
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
# Runs a specified shell command in a separate thread. | |
# If it exceeds the given timeout in seconds, kills it. | |
# Passes stdout, stderr, thread, and a boolean indicating a timeout occurred to the passed in block. | |
# Uses Kernel.select to wait up to the tick length (in seconds) between | |
# checks on the command's status | |
# | |
# If you've got a cleaner way of doing this, I'd be interested to see it. | |
# If you think you can do it with Ruby's Timeout module, think again. | |
def run_with_timeout(*command) | |
options = command.extract_options!.reverse_merge(timeout: 60, tick: 1, cleanup_sleep: 0.1, buffer_size: 10240) |
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
/*static*/ String CJSONEntry::quoteValue(const String& strValue) | |
{ | |
int pos = 0, start_offset = 0; | |
unsigned char c; | |
String strRes = "\""; | |
const char* str = strValue.c_str(); | |
do | |
{ | |
c = str[pos]; | |
switch(c) { |
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
3.141592653589793238462643383279502884197169399375105820974944592307816406286208 | |
089986280348253421170679821480865132823066470938446095505822317253594081284811 | |
174502841027019385211055596446229489549303819644288109756659334461284756482337 | |
867831652712019091456485669234603486104543266482133936072602491412737245870066 | |
063155881748815209209628292540917153643678925903600113305305488204665213841469 | |
519415116094330572703657595919530921861173819326117931051185480744623799627495 | |
673518857527248912279381830119491298336733624406566430860213949463952247371907 | |
021798609437027705392171762931767523846748184676694051320005681271452635608277 | |
857713427577896091736371787214684409012249534301465495853710507922796892589235 | |
420199561121290219608640344181598136297747713099605187072113499999983729780499 |