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
/* | |
Problem: | |
A group of 2n people, consisting of n individuals from Team A and n individuals from Team B, are seated in a row of 2n+1 chairs in the following arrangement: | |
A...A_B...B (where "_" represents an empty seat) | |
The task is to find a method to rearrange the seating positions of each person to achieve the following order: | |
B...B_A...B | |
Rules: | |
- In each step, only one person can be moved to an empty seat. |
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
var AStar = function(){ | |
this.getBestState = function(states){ | |
var bestState = states[0]; | |
var bestIdx = 0; | |
for (var i = 0; i < states.length; i++){ | |
if (states[i].distance + states[i].estimate < bestState.distance + bestState.estimate){ | |
bestState = states[i]; | |
bestIdx = i; | |
} |
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
var AStar = function(){ | |
this.getBestState = function(states){ | |
var bestState = states[0]; | |
var bestIdx = 0; | |
for (var i = 0; i < states.length; i++){ | |
if (states[i].distance + states[i].estimate < bestState.distance + bestState.estimate){ | |
bestState = states[i]; | |
bestIdx = i; | |
} |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.4.0/p5.js"></script> | |
</head> | |
<body> | |
<script> | |
let t = 0; | |
let minT = -15; // Minimum value of t (imaginary part) | |
let maxT = 15; // Maximum value of t (imaginary part) |
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
var Board = function(_m) { | |
this.m = _m; | |
this.rowCheck = function(r, v) { | |
for (let i = 0; i < 9; i++) { | |
if (this.m[r][i] == v) return false; | |
} | |
return 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
using System; | |
using System.Collections.Generic; | |
/// <summary> | |
///Gargamel is an evil notorious witch. He has a chest full of treasures that he had plundered from the Smurf. | |
///One day, the Smurfs sneaked into the Gargamel's mansion and stole the chest. | |
///However, this chest was locked with a three-digit padlock and the Smurfs cannot break the chest. | |
///Finally, they found a recipe that engraved on the chest tobe the clue for the pasword: | |
/// (i) 1,4,7 - one digit is right but in the wrong place | |
/// (ii) 1,8,9 - one digit is right and in the correct place |
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
// SPDX-License-Identifier: Quang Le | |
pragma solidity ^0.8.9; | |
contract RANDAOLottery { | |
enum round_states { | |
Commit, | |
Reveal, | |
Finished, | |
Rolledback | |
} |
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 Solve(int[,] m, int sCol, int eCol, int sRow, int eRow, int br, int bc) | |
{ | |
// determine the direction of the tile based on the mising block | |
var direction = GetDirection(sCol, eCol, sRow, eRow, br, bc); | |
// solve for size = 1 | |
if ((eCol - sCol == 1) && (eRow - sRow == 1)) | |
{ | |
PlaceOne(m, sCol, eCol, sRow, eRow, direction, cIdx); | |
cIdx += 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
public class RSA | |
{ | |
private int _n; | |
private int _e; | |
private int _d; | |
private int _phi; | |
public RSA(int p, int q) | |
{ | |
_n = p * q; |
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
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace Tuenti12 | |
{ | |
class Node : IComparable<Node> |
NewerOlder