Skip to content

Instantly share code, notes, and snippets.

function groupAnnagrams(arr) {
const arrObject = {} // create an empty object to store each words
for(let i=0; i <arr.length; i++){
arrObject[arr[i]] = {} // create empty object so it wont be undefined
for(let j = 0; j < arr[i].length; j++){
const key = arrObject[arr[i]][arr[i][j]];
if(!key){ //check falsy value
arrObject[arr[i]][arr[i][j]] = 1; // set 1 if not exist
}else{
@kwaiks
kwaiks / dio_helper.dart
Created January 27, 2021 10:53
Flutter Dio Interceptor for refresh token
class DioHelper {
final Dio dio;
DioHelper({@required this.dio});
final CustomSharedPreferences _customSharedPreferences =
new CustomSharedPreferences();
static String _baseUrl = BASE_URL;
String token = "";
void initializeToken(String savedToken) {