注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号 
x
新人求加米!
OA:
6 questions, see website:
Phone:
card token game:
# +-----+
# Point value --> |2 G| <-- Card Color
# | |
# Cost --> |5B |
# |3G |
# +-----+
# Notation: Red - R, Blue - U, Black - B, Green - G, White – W
# In this game players will have a set of colored tokens (Red, Blue, Green, Black, White). Their objective is to purchase cards using those tokens. Cards will have a cost of some number of the above listed colored tokens. For example a card can cost 2 blue tokens and 1 green tokens. If a player has 2 blue tokens and 1 red token they cannot buy the card because they do not have the necessary green currency.
# The goal for this part is to implement a function that determines if a card can be purchased by a particular player given the current state of the game. How you choose to represent the purchase, game state, and function signature is completely up to you.
# Given a “Card” and “Player” as modeled in part 1, update the game “state” to reflect that card being purchased by that player.
—----------------------------------------------------------------------------------------------------
Token card games
Given card with cost in terms of tokens. For eg to buy some Card A, you need 3 Blue tokens and 2 Green tokens. Tokens can be of Red, Green, Blue, Black or White color.. 1point 3acres
Now there is player who is holding some tokens. For eg player has 4 Blue tokens and 2 Green tokens, then player can buy above Card A. Lets say if player only has 2 Blue tokens and 2 Green tokens, then player can not buy Card A above as player is short of 1 Blue token.
Write a method that returns true if player can buy the card or false otherwise.
More examples :
Cost of Card : 2 White, 1 Black and 4 Blue
If Player has : 2 White, 2 Black and 4 Blue, method will return true
If Player has : 2 White, 2 Green and 4 Blue, method will return false.
1、Implement canPurchase and purchase.
2、Discount with card owned
(e.g. if already have 3 Red Cards,next card to purchase costs N Red Money,at actual purchase only need to pay N-3 Red Money).
cost: {"Red":4}
player:{"Red":7,"Bule":5}.
purchase()
player:{"Red":3,"Bule":5}.--
playerCard:{"Red":1}
purchase(). 1point 3acres
player:{"Red":0,"Bule":5}
playerCard:{"Red":2}
3. Gold color: gold color can substitute any color. E.g.one card costs N red money, but only have N-1 red money, and 1 or more gold money, then can afford buying the card.
Proposed solution: since there are only 5 color money/tokens, in Card, define a int[] cost = {1,2,3,4,5} to imply how many color money/token each needed to purchase this card. Purchase function is defined in player, parse in card id to purchase,use player’s money/tokens to compare against the card cost to determine affordability?
checker board
part1: given a state of the board and a player, get all possible next moves of all checkers of the player
part2: given a move, make a movement and update the board
Part3: …
8x8 checker board, can move diagonal to next 2 locations. Can’t move when reach the end or next 2 locations are occupied.
You are to define everything(including class, function, input, output). Write a function to take in current board status, output all possible next move.
Game of checker see details in
Implement an api (i used Java)
List<Pair<Pair<Integer, Integer>>> nextMove(char[][] board, boolean turn)
Board: records current board status,board[j] can be 'O', 'X' or ''.
turn: define it yourself (could be change to X side to move or O side to move next)
Return: all possible next move (no need to consider killing components, no king, only consider whether can go to the next location)
EX: [ ((2,3),(3,4)), ((5,8),(4,9)), ... ] => move from (2,3) to (3,4), move from (5,8)to(4,9), etc
follow up :
What if add a King for both side, how to modify? What if rule changed to allow killing the other c
3 user interface steps: party size, date, and location ==click search==> A list of restarant, each of which shows list of time available ==click the time==> review of reservation and confirm button to reserve
搜索有空的时间 还有预定 这两个函数 包括桌子结构
469
93
Leetcode ip address
Find shortest path 62, 1091
给一个数字string到字母list的map,给一个string,找出所有可能的字母combination。例如'1' -> ['a', 'b'] 跟刷题网的手机按键有多少字母组合题一样。Followup,如果多个数字可以map到一个字母list时,怎么做。
Leetcode phone keypad
Http协议,网站访问过程
五子棋简化版3子棋,在3*3board上, - 要写command输入和print(可以看文档), - 两个player 一个机器(随便下) command输入, - 每次下完判断输赢 348?
Coding: Given a string of words divided by spaces and number of N,Return a sentence with 5 words. Every word is picked randomly after the last occurrence, if it is the end of the string next round back to first one. First word is picked randomly from any of the words. E.g. "let us go to the supermarket to get the to go bundle" First word can be "go", second be be either "to" or "bundle". If n = 5, one possible solution is: "go bundle let us go"
Given a string, implement a method that given a word in the sentence, randomly return one of its following words. Plus, if the given word is in the end of the string, the first word is counted as its following word. solution: write a hashmap, key is every word in the string, value is a list of word that follows it. Follow up: given a substring of the sentence, return the next words of the substring.
文章随机组成output的那道题 提前写完了 问了个follow up 如果不是一个单词一个单词的拼接的话怎么办 一开始是随机抽一个词然后随机选后面的 现在pass进来一个variable N 这个 N 代表每次要检查的最小subarray的长度 一开始还是随机选一个单词 如果N=3 就直接form从这个词开始长度为3的subarray 然后下次再form的时候需要查这整个subarray后面可能出现的词 加到结果里 每次form的时候都查结果里最后3位之后可能出现的词
468
913
有一个shipment class有weight这个filed 然后不同weight区间对应不同rate 需要计算一个 shipment的价格
91
新人求加米!多谢! |