gpt4 book ai didi

c# - 面试失败 : And I thought Google was tough

转载 作者:太空狗 更新时间:2023-10-30 00:33:53 26 4
gpt4 key购买 nike

<分区>

好吧,我接受过一些艰苦的采访,但这太荒谬了。我被问了一个问题,给了笔、纸、计算器、“URL 安全”字符的定义,并在 20 分钟内完成了这个问题。问题是(据我所知):

Write a function to generate a unique URL-safe string that represents a given point in time for a file modification on an IIS web server that we're deploying tomorrow. The resolution of a "point in time" is one second.

.NET RegEx pattern for "URL-safe" characters = [0-9a-zA-Z\$\-\_\.\+\!\*\'\(\)]

我 panic ,只是写下了我的想法,而不是编写实际代码。他们在查看我的“答案”后解雇了我,因为我实际上并没有写任何代码。 :(

我写的是这样的:

- 365 days in a year so "day of year" can be represented in 2 bytes
- 4 digits in year (0 - 9999) so year can be represented in 3 bytes
- 2 digits in hour (0 - 23) so year can be represented in 1 byte
- 2 digits in minutes (0 - 59) so minutes can be represented in 1 byte
- 2 digits in seconds (0 - 50) so seconds can be represented in 1 byte

TOTAL: 2+3+1+1+1 = 8 bytes total that use 0 - 255

- URL-safe range == 10 + 24 + 24 + 10 == 0-9 + a-z + A-Z + special chars == 68
- 4 bits required to represent URL safe char

ANSWER:

- A byte is 8 bits
- Only 4 bits per byte needed to represented the 8 bytes in a date
- 8 / 2 = 4

FINAL ANSWER:
- Only 4 actual bytes needed to represent hash

换句话说,时间戳哈希最多可以合理地用 4 个 URL 安全字符表示。

你会如何回答这个问题?!我觉得我是一个非常优秀的开发人员,但我已经有很多年不用担心计算 2 的幂了!

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com