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 os | |
from typing import List, Tuple | |
import itertools | |
possibilities = set([1, 2, 3, 4, 5, 6, 7, 8, 9]) | |
def solve(board: List[List[int]]) -> List[List[int]] | None: | |
if is_solved(board): |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>Document</title> | |
<style> | |
#messages { | |
display: flex; | |
flex-direction: column; |
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 java.util.*; | |
import java.time.Instant; | |
import java.time.Duration; | |
public class EightPuzzleAnalysis { | |
public static void main(String[] args) { | |
int[][] initialState = { | |
{ 7, 2, 4 }, | |
{ 5, 0, 6 }, | |
{ 8, 3, 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
class Type | |
attr_accessor :name | |
attr_accessor :supertype | |
def initialize(name, supertype = nil) | |
@name = name | |
@supertype = supertype | |
end | |
def is?(type) |
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
package org.example; | |
import java.util.concurrent.RecursiveAction; | |
import java.util.concurrent.ForkJoinPool; | |
public class ParallelMergeSort { | |
private static final int THRESHOLD = 100; | |
private static class MergeSortTask extends RecursiveAction { | |
private final Comparable[] array; |
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 socket | |
import sys | |
import threading | |
from message import Message | |
# Function to handle receiving messages from the server | |
def receive_messages(client_socket): | |
while True: | |
try: |
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
const EventEmitter = require("events"); | |
function fetchUserName(id) { | |
return new Promise((resolve, reject) => { | |
setTimeout(() => resolve(`user${id}`), 1000); | |
}); | |
} | |
function fetchUserAge(id) { | |
return new Promise((resolve, reject) => { |
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 <vector> | |
auto partition(std::vector<int>& arr, int start, int end) -> int { | |
auto pivotIndex = end; | |
for (int i = start; i < pivotIndex; i++) { | |
if (arr[i] > arr[pivotIndex]) { | |
auto temp = arr[i]; | |
arr[i] = arr[pivotIndex]; | |
arr[pivotIndex] = temp; | |
pivotIndex = i; |