you browser tab start homepage visit url history number step forward history number stepsimplement BrowserHistory classbrowserhistorystring homepage Initializes object homepage browservoid visitstre url visit url current page it clear forward historystre backint step move step history if return x step history step x return x step return current url move history stepsstring forwardint step move step forward history if forward x step history step x forward x step return current url forwarding history step exampleinputbrowserhistoryvisitvisitvisitbackbackforwardvisitforwardbackbackleetcodecomgooglecomfacebookcomyoutubecom111linkedincom227outputnullnullnullnullfacebookcomgooglecomfacebookcomnulllinkedincomgooglecomleetcodecomexplanationbrowserhistory browserhistory new browserhistoryleetcodecombrowserhistoryvisitgooglecom you leetcodecom visit googlecombrowserhistoryvisitfacebookcom you googlecom visit facebookcombrowserhistoryvisityoutubecom you facebookcom visit youtubecombrowserhistoryback1 you youtubecom facebookcom return facebookcombrowserhistoryback1 you facebookcom googlecom return googlecombrowserhistoryforward1 you googlecom forward facebookcom return facebookcombrowserHistoryvisitlinkedincom you facebookcom visit linkedincombrowserhistoryforward2 you linkedincom forward stepsbrowserhistoryback2 you linkedincom step facebookcom googlecom return googlecombrowserhistoryback7 you googlecom step leetcodecom return leetcodecom Constraints1 homepagelength 201 urllength 201 step 100homepage url consist low case English lettersat 5000 call visit forward