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 object = { | |
"allStudents": [ | |
{ | |
"name": "John", | |
"hobbies": { | |
"sport": "Football", | |
"music": "Piano" | |
} , | |
}, | |
{ |
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
//Author: Owamoyo Evans - lordvidex | |
//Email: lordvidex.prime@gmail.com | |
//GitHub: https://github.com/lordvidex | |
import 'package:flutter/material.dart'; | |
//Logic on third page | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
@override |
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
import 'package:flutter/material.dart'; | |
import 'dart:math'; | |
Map<int, int> _answer = {}; | |
String update = '', reason = ''; | |
const List<String> questions = [ | |
'How do you view ECX as a whole?', | |
'What track of ECX are you in?', | |
'Why did you join ECX?', | |
'What updates will you like to see?', |
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
import 'dart:io'; | |
Map<String,int> band = const { | |
'black':0, | |
'brown':1, | |
'red':2, | |
'orange':3, | |
'yellow':4, | |
'green':5, | |
'blue':6, |
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
String reversedString(String s){ | |
return s.split('').reversed.join(); | |
} | |
void main() { | |
String s = 'Evans is a geek'; | |
print(reversedString(s)); | |
} |
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
import 'package:flutter/material.dart'; | |
void main() { | |
runApp(MyApps()); | |
} | |
class MyApps extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( |
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
Map<String,bool> count = {}; | |
bool isIsogram(String s) { | |
var answer = true; | |
s = s.replaceAll(new RegExp(r'\s|-'), '').toLowerCase(); | |
s.split('').forEach((sd){ | |
if(count[sd]==null)count[sd]= true; | |
else answer = false; | |
}); | |
return answer; | |
} |
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 countTheWord(String s){ | |
Map<String,int>answer = {}; | |
//first replace all space related symbols or unicodes to ' ' | |
//for uniformity | |
var myString = s.toLowerCase().replaceAll(new RegExp(r'\\t|\\n'),' '); | |
//Regular expression that matches all required words and adds them to map | |
var sh = RegExp(r"(\w+'\w+)|(\w+)"). | |
allMatches(myString).map((m)=>m[0]).forEach((f){ | |
answer[f]==null? | |
answer[f]=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
import 'dart:math'; | |
String differenceOfSquares(int n){ | |
//absolute difference of squares of sum &&& sum of squares | |
return (pow((n*(n+1))/2,2)-((n*(n+1)*(2*n+1))/6)).abs().toStringAsFixed(0); | |
} | |
void main() { | |
int n = 10; | |
print(differenceOfSquares(n)); | |
} |
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
import 'dart:math'; | |
String findPrimeFactors(int n) { | |
assert(!n.isNegative && n.isFinite); //just some extra input validations | |
List<num> ans = []; | |
while (n % 2 == 0) { | |
n ~/= 2; | |
ans.add(2); | |
} | |
for (var x = 3; x <= sqrt(n); x += 2) | |
while (n % x == 0) { |
OlderNewer