Skip to content

Instantly share code, notes, and snippets.

View kishan-dhankecha's full-sized avatar
🐢
Might be slow to respond!

Kishan Dhankecha kishan-dhankecha

🐢
Might be slow to respond!
  • Gujarat, India.
  • 00:51 (UTC +05:30)
View GitHub Profile
@kishan-dhankecha
kishan-dhankecha / Fancy Button - Flutter
Created August 26, 2022 06:33 — forked from mkiisoft/Fancy Button - Flutter
Fancy Button made for Flutter Games and Apps
import 'package:flutter/material.dart';
class FancyButton extends StatefulWidget {
const FancyButton({
Key key,
@required this.child,
@required this.size,
@required this.color,
this.duration = const Duration(milliseconds: 160),
this.onPressed,
@kishan-dhankecha
kishan-dhankecha / can-construct.js
Created October 13, 2021 09:19
Can construct function with memoization [JAVASCRIPT]
/// Write a function 'canConstruct(target, wordBank)' that accepts a
/// target string and an array of strings.
/// The function should return a boolean indicating whether or not the
/// 'target' can be constructed by concatenating elements of the
/// 'wordBank' array.
/// You may reuse elements of ‘wordBank' as many times as needed.
const canConstruct = (target, wordBank, memory = {}) => {
@kishan-dhankecha
kishan-dhankecha / best-sum.js
Last active October 13, 2021 09:16
Best Sum function with memoization [JAVASCRIPT]
/// Write a function 'bestSum(targetSum, numbers)' that takes in a
/// targetSum and an array of numbers as arguments.
/// The function should return an array containing the shortest
/// combination of numbers that add up to exactly the targetSum.
/// If there is a tie for the shortest combination, you may return any
/// one of the shortest.
const bestSum = (targetSum, numbers, memory = {}) => {
@kishan-dhankecha
kishan-dhankecha / how-sum.js
Last active October 13, 2021 09:16
How Sum function with memoization [JAVASCRIPT]
/// Write a function 'howSum(targetSum, numbers)' that takes in a
/// targetSum and an array of numbers as arguments.
/// The function should return an array containing any combination of
/// elements that add up to exactly the targetSum. If there is no
/// combination that adds up to the targetSum, then return null.
/// If there are multiple combinations possible, you may return any
/// single one.
@kishan-dhankecha
kishan-dhankecha / can-sum.js
Last active October 13, 2021 09:17
Subset Sum function with memoization [JAVASCRIPT]
/// Write a function 'canSum( targetSum, numbers)' that takes in a
/// targetSum and an array of numbers as arguments.
/// The function should return a boolean indicating whether or not it
/// is possible to generate the targetSum using numbers from the array.
/// You may use an element of the array as many times as needed.
/// You may assume that all input numbers are nonnegative.
const canSum = (targetSum, numbers, memory = {}) => {
@kishan-dhankecha
kishan-dhankecha / grid-traveler.js
Last active August 5, 2022 17:12
Grid Traveler function with memoization [JAVASCRIPT]
/// Say that you are a traveler on a 2D grid. You begin in the
/// top-left corner and your goal is to travel to the bottom-right
/// corner. You may only move down or right.
/// In how many ways can you travel to the goal on a grid with
/// dimensions m * n?
/// Write a function 'gridTraveler(m, n)' that calculates this.
const gridTraveler = (n, m, memory = {}) => {
@kishan-dhankecha
kishan-dhankecha / fibonacci.js
Last active October 12, 2021 15:48
Fibonacci function with memoization [JAVASCRIPT]
/// Write a function 'fib(n)' that takes in a number as an argument.
/// The function should return the n-th number of the Fibonacci sequence.
/// The 1st and 2nd number of the sequence is 1.
/// To generate the next number of the sequence, we sum the previous two.
/// fib(n): 1, 1, 2, 3, 5, 8, 13, 21, 34,
const fib = (num, memory = {}) => {
// Check in memory.
@kishan-dhankecha
kishan-dhankecha / main.dart
Created October 8, 2021 05:54
Extract first numbers from the String that starts with numbers.
void main() {
/// Temporary string for store number character.
var tempString = '';
/// Input string.
const string = '123sdc123s1d s sd155626sd s ds';
/// Split the input string in list of characters.
import 'dart:io';
void main() {
print('PROJECT FROM: https://github.com/Kishan-Dhankecha');
print('--------------------');
//Take the inputs from User
print('Enter the count of column:');
var _column = int.parse('${stdin.readLineSync()}');
print('Enter the count of row:');
@kishan-dhankecha
kishan-dhankecha / main.dart
Last active October 12, 2021 16:00
Get new List with id and number of times object repeats in a List with dart.
String checkCountOf = 'id';
List objects = [
{"id": "123"},
{"id": "123"},
{"id": "20"},
{"id": "35"},
{"id": "20"},
];