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
long long fibonacci(long long n) { | |
if (n <= 1) return 1; | |
return fibonacci(n - 1) + fibonacci(n - 2); | |
} |
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 'dart:ffi'; | |
// long fibonacci(int n) | |
typedef NativeFibonacci = Int64 Function(Int64 n); | |
typedef DartFibonacci = int Function(int n); | |
class Fibonacci { | |
static final dll = DynamicLibrary.open('fibonacci.dll'); | |
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 'dart:convert'; | |
void main() { | |
var jsonSource = """ | |
{ | |
"Events": [ | |
{ | |
"id": 1, | |
"event_name": "Cake tasting", | |
"event_photo": "https://dispensaries.s3.amazonaws.com/event_photo/Southern_Cali_Kush_3.jpg", |
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 'package:html/parser.dart'; | |
void main() { | |
var document = parse(body); | |
var selectElements = document | |
.getElementsByClassName('hello') | |
.where((element) => element.attributes['data-time'] == '9112020') | |
.map((item) => item.text) | |
.toList(); | |
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 'dart:async'; | |
void main() { | |
runZoned(() { | |
try { | |
try { | |
throw 'exception 1'; | |
} catch (e) { | |
throw LinkedException('exception 2',e); | |
} |
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
s = list(input()) | |
stk = [] | |
for c in s: | |
if c == '=': | |
if stk: | |
stk.pop() | |
else: | |
stk.append(c) | |
print(''.join(stk)) |
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
/* | |
* Ali Ghanbari - 970216657 | |
* online compiler: https://dartpad.dev/a72a868f4690256e2f58f69b01823942?null_safety=true | |
*/ | |
/// | |
/// Constants | |
/// | |
enum Action { Left, Right, Suck } | |
enum RoomState { Clean, Dirty } |
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
/* | |
* Ali Ghanbari - 970216657 | |
* online compiler: https://dartpad.dev/a69b65959d0207f02adf4e78c532f87a?null_safety=true | |
*/ | |
/// | |
/// Constants | |
/// | |
enum Action { Left, Right, Suck, Idle } | |
enum RoomState { Clean, Dirty } |
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
/* | |
* Ali Ghanbari - 970216657 | |
* online compiler: https://dartpad.dev/b7812076139d58b2c46258c33b5e7f30?null_safety=true | |
*/ | |
import 'dart:math'; | |
const n = 8; | |
enum Moves { Up, Down } | |
final random = Random(); |
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
/* | |
Ali Ghanbari - 970216657 | |
online compiler: https://dartpad.dev/a2c7d1d325c61bf06df68c85235d8ae9?null_safety=true | |
*/ | |
const n = 3; | |
enum Position { Left, Right } | |
enum Move { MM, M, MC, C, CC, None } | |
void main() { |
OlderNewer