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
##Longest Substring with At Most K Distinct Characters | |
var lengthOfLongestSubstringKDistinct = function(s, k) { | |
//incase the length of the string is the same or less than the distict number then return the length of the string. | |
if(k >= s.length ){ | |
return s.length; | |
} | |
//define an empty hash map variable. | |
let hmap = {} | |
let max = 0; | |
//iterating through the string. |
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
//SPDX-License-Identifier: UNLICENSED | |
pragma solidity ^0.8.11; | |
//Different data structures | |
contract Variable{ | |
// Fized size types which hold a fixed memory size | |
bool isReady; | |
uint a ; | |
address recepient; | |
//used mainly for strings that wont exceed 32byte |