注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号
x
Ramp 2024 Coding Assessment (Industry Coding Framework)白嫖OA, OOD,一共四个level,我这个版本不知道地里有没有
The basic level of the in-memory database contains records. Each record can be accessed with a unique identifier key, which is of string type. A record contains several field-value pairs, with field as string type and value as integer type. All operations have a timestamp parameter — a stringified timestamp in milliseconds. It is guaranteed that all timestamps are unique and are in a range from 1 to 109. Operations will be given in order of strictly increasing timestamps. Timestamps will be needed starting from Level 3.
void set(int timestamp, String key, String field, int value) — should insert a field-value pair to the record associated with key. If the field in the record already exists, replace the existing value with the specified value. If the record does not exist, a new one is created.
boolean compareAndSet(int timestamp, String key, String field, int expectedValue, int newValue) — should update the value of field in the record associated with key to newValue if the current value equals expectedValue. If expectedValue does not match the current value, or either key or field does not exist, this operation is ignored. This operation should return true if the field was updated and false otherwise.
boolean compareAndDelete(int timestamp, String key, String field, int expectedValue) — should remove the field field in the record associated with key if the previous value equals expectedValue. If expectedValue does not match the current value, or either key or field does not exist, this operation is ignored. This operation should return true if the field was removed and false otherwise.
Optional<Integer> get(int timestamp, String key, String field) — should return the value contained within field of the record associated with key. If the record or the field does not exist, should return Optional.empty().
List<String> scan(int timestamp, String key) — should return a list of strings representing the fields of the r您好! 本帖隐藏的内容需要积分高于 188 才可浏览 您当前积分为 0。 使用VIP即刻解锁阅读权限或查看其他获取积分的方式 游客,您好! 本帖隐藏的内容需要积分高于 188 才可浏览 您当前积分为 0。 VIP即刻解锁阅读权限 或 查看其他获取积分的方式 , but should also update TTL of the newValue. This operation should return true if the field was updated and false otherwise. It is guaranteed that ttl is greater than 0.
Optional<Integer> getWhen(int timestamp, String key, String field, int atTimestamp) — should return the value of field at atTimestamp from the record associated with key. If atTimestamp is 0, perform the get operation described in Level 1. It is guaranteed that atTimestamp will not be greater than timestamp. If the specified field or record did not exist at the given timestamp, return Optional.empty(). |