IncredibleThings

导航

2018年11月24日 #

Google - chanceToLose24Game

摘要: /* 一个类似24点的游戏,假设牌桌上有无数张1-10的牌,然后你手上的牌的总和是k,现在你可以随机到牌桌上抽牌加到总和里,如果你手上牌的总和在20-25之间就是win,如果总和超过25就是lose,现在让你求lose的概率。 这一题我好像在地里见到过但是当时那个楼主说他没有做出来,所以我就也附上一下我的大概解法。 首先因为每张牌都是无数张,所以抽任何一张牌的概率都是0.1。然后就是要考虑到有很... 阅读全文

posted @ 2018-11-24 12:44 IncredibleThings 阅读(234) 评论(0) 推荐(0)

Google - Find Most People in Chat Log

摘要: 1. 给你一个chatting log file,format大概是这样的: A: bla B: bla bla C: bla bla bla 要你找出说话最多(看word number) 的K个人 而且代码要从读file开始写 /* 1. 给你一个chatting log file,format大概是这样的: A: bla B: bla bla C: bla bla bla 要你找出说话最... 阅读全文

posted @ 2018-11-24 05:36 IncredibleThings 阅读(225) 评论(0) 推荐(0)

LeetCode - Maximum Frequency Stack

摘要: Hash map freq will count the frequence of elements.Hash map m is a map of stack.If element x has n frequence, we will push x n times in m[1], m[2] .. 阅读全文

posted @ 2018-11-24 04:39 IncredibleThings 阅读(162) 评论(0) 推荐(0)