Skip to content

Instantly share code, notes, and snippets.

View olumidayy's full-sized avatar
🍝
.

Olumide Nwosu olumidayy

🍝
.
View GitHub Profile
void main() {
print(isLeapyear(1900));
}
bool isLeapyear(year){
if(year % 4 != 0){
return false;
}else if(year % 100 == 0 && year % 400 != 0){
return false;
}
@olumidayy
olumidayy / main2.dart
Last active March 27, 2020 12:02
day3
void main() {
print(isIsogram2('qw- - e rty'));
print(isIsogram('qw- - e rty'));
}
String letters = 'abcdefghijklmnopqrstuvwxyz';
bool isIsogram(String word){
String newStr = '';
@olumidayy
olumidayy / main1530.dart
Last active May 16, 2020 04:12
android day 15
void main() {
print(unique([1,5,9,2,2,11,333,567,2,4,5,5,3,5,6,4,8,9,10,32,12,56, 8]));
}
List<num> sorted(List<num> arr) {
/* This function takes in a List of numbers
* and returns the sorted list in ascending order
*
* NB: Based on the Comb Sort algorithm */
var l = arr.length, gap = l, shrink = 1.3;
void main() {
print(sorted([2.2, 3, 42, 3444, 1, 67, 2, 7, 234, 564, 6, 8]));
}
List<num> sorted(List<num> arr) {
/* This function takes in a List of numbers
* and returns the sorted list in ascending order
*
* NB: Based on the Comb Sort algorithm
* https://en.wikipedia.org/wiki/Comb_sort*/
@olumidayy
olumidayy / main1330.dart
Last active May 14, 2020 02:48
mobile day 13
import 'dart:math';
void main() {
print(Taxi(2));
}
int Taxi(n) {
/* function to find the n-th
* taxicab number*/
List li = [];
@olumidayy
olumidayy / main1130.dart
Last active May 11, 2020 23:03
mobile day 7
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
debugShowCheckedModeBanner: false,
@olumidayy
olumidayy / main1030.dart
Last active May 10, 2020 20:42
day 10 Mobile
void main() {
print(is_perfect_square(500000000000000000));
}
bool is_perfect_square(int n) {
/** This function takes in a number and
* returns a boolean value indicating
* whether it is a perfect square or not */
var start = 0, end = n;
@olumidayy
olumidayy / main.dart
Created April 2, 2020 11:00
day 9 mobile
void main() {
print(isPangram('Mr. Jock, TV quiz PhD., bags few lynx'));
print(isPangram('The quick brown fox jumps over the lazy dog.'));
}
String isPangram(sentence) {
// checks to see if the sentence contains at least one occurence each
// of all the English alphabets
String letters = 'abcdefghijklmnopqrstuvwxyz';
sentence = sentence.toLowerCase();
import 'dart:math';
void main() {
getNumberOfGrains(8);
}
void getNumberOfGrains(n) {
var totalNumber =
[for (var i = 0; i < 64; i++) pow(2, i)].reduce((a, b) => a + b);
int numberOfGrains = pow(2, n - 1);
import 'package:flutter/material.dart';
void main() {
runApp(MaterialApp(
home: new Home(),
));
}
class Home extends StatefulWidget {
@override