回复: 3
跳转到指定楼层
上一主题 下一主题
收起左侧

Exos

全局:

2019(10-12月) Other 其他 硕士 全职@Exos - 猎头 - 在线笔试  | | Other | 在职跳槽

注册一亩三分地论坛,查看更多干货!

您需要 登录 才可以下载或查看附件。没有帐号?注册账号

x
#
# In order to solve the problems below you can import any standard
# python3 library.
#
# If you don't know Python, implement it in any other language.
#
# Good luck!
#


############
#
# Cheap Crowdfunding Problem
#
# There is a crowdfunding project that you want to support. This project
# gives the same reward to every supporter, with one peculiar condition:
# the amount you pledge must not be equal to any earlier pledge amount.
#
# You would like to get the reward, while spending the least amount > 0.
#
# You are given a list of amounts pledged so far in an array of integers.
# You know that there is less than 100,000 of pledges and the maximum
# amount pledged is less than $1,000,000.
#
# Implement a function find_min_pledge(pledge_list) that will return
# the amount you should pledge.
#
############
# The idea is based on bucket sort, we can easily do it with a sort, but the time complexity will be n * long(n)

def find_min_pledge(pledge_list):
    nums = len(pledge_list)

    for num in range(nums):
        while 0 <= pledge_list[num] - 1 < nums and pledge_list[pledge_list[num] - 1] != pledge_list[num]:
            tmp = pledge_list[num] - 1
            pledge_list[num], pledge_list[tmp] = pledge_list[tmp], pledge_list[num]

    for num in range(nums):
        if pledge_list[num] != num + 1:
            return num + 1

    return nums + 1


assert find_min_pledge([1, 3, 6, 4, 1, 2]) == 5
# print(find_min_pledge([1, 3, 6, 4, 1, 2]))

assert find_min_pledge([1, 2, 3]) == 4
# print(find_min_pledge([1, 2, 3]))

assert find_min_pledge([-1, -3]) == 1
# print(find_min_pledge([-1, -3]))

############
#
# Extract Titles from RSS feed
#
# Implement get_headlines() function. It should take a url of an RSS feed
# and return a list of strings representing article titles.
#
############

google_news_url="https://news.google.com/news/rss"


def get_headlines(rss_url):
    """
    @returns a list of titles from the rss feed located at `rss_url`   
    """
    return []

print(get_headlines(google_news_url))



############
#
# Streaming Payments Processor
#
# The function `process_payments()` is processing a large, but finite
# amount of payments in a streaming fashion.
#
# It relies on two library functions to do its job. The first function
# `stream_payments_to_storage(storage)` reads the payments from a payment
# processor and writes them to storage by calling `storage.write(buffer)`
# on it's `storage` argument. The `storage` argument is supplied by
# calling `get_payments_storage()` function. The API is defined below.
#
# TODO: Modify `process_payments()` to print a checksum of bytes written
# by `stream_payments_to_storage()`. The existing functionality
# should be preserved.
#
# The checksum is implemented as a simple arithmetic sum of bytes.
#
# For example, if bytes([1, 2, 3]) were written, you should print
您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 188 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限 或 查看其他获取积分的方式
Unlock interview details and practice with AI
Curated Interview Questions from Top Companies
ct(dict):
    """
    Given a dict representing a row from a namespaces csv file,
    returns a DAG configuration as a pair whose first element is the
    DAG name
    and whose second element is a dict describing the DAG's properties
    """
    namespace = dict['Namespace']
    return (dict['Airflow DAG'],
            {"earliest_available_delta_days": 0,
             "lif_encoding": 'json',
             "earliest_available_time":
                 get_value(dict, 'Available Start Time', '07:00'),
             "latest_available_time":
                 get_value(dict, 'Available End Time', '08:00'),
             "require_schema_match":
                 get_value(dict, 'Requires Schema Match', 'True',
                           mapper=string_to_bool),
             "schedule_interval":
                 get_value(dict, 'Schedule', '1 7 * * * '),
             "delta_days":
                 get_value(dict, 'Delta Days', 'DAY_BEFORE',
                           lookup=DeltaDays),
             "ftp_file_wildcard":
                 get_value(dict, 'File Naming Pattern', None),
             "ftp_file_prefix":
                 get_value(dict, 'FTP File Prefix',
                           ftp_file_prefix(namespace)),
             "namespace": namespace
             }
            )


# DeltaDays is not defined
# No error checking. dict.get() is better than directly assume key will be in dict

原题奉上, 第二题完全看不懂在问什么


评分

参与人数 3大米 +33 收起 理由
pagepeng + 1 赞一个
匿名用户-AS1IS + 30
finding_alpha + 2 给你点个赞!

查看全部评分


上一篇:MathWork EDG HireVue面经
下一篇:近两个月L家电面题目汇总
🔗
moonrockrose 2020-7-4 02:24:15 | 只看该作者
全局:
那两个stream的题完全没看懂要干什么?不知道楼主做了没有?
回复

使用道具 举报

🔗
moonrockrose 2020-7-4 02:27:43 | 只看该作者
全局:
第一题就是个find 1st missing positive?搞得这么绕
回复

使用道具 举报

地里匿名用户
🔗
匿名用户-GXJUN  2022-6-7 11:00:54
楼主有店面吗
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册账号
隐私提醒:
  • ☑ 禁止发布广告,拉群,贴个人联系方式:找人请去🔗同学同事飞友,拉群请去🔗拉群结伴,广告请去🔗跳蚤市场,和 🔗租房广告|找室友
  • ☑ 论坛内容在发帖 30 分钟内可以编辑,过后则不能删帖。为防止被骚扰甚至人肉,不要公开留微信等联系方式,如有需求请以论坛私信方式发送。
  • ☑ 干货版块可免费使用 🔗超级匿名:面经(美国面经、中国面经、数科面经、PM面经),抖包袱(美国、中国)和录取汇报、定位选校版
  • ☑ 查阅全站 🔗各种匿名方法

本版积分规则

>
快速回复 返回顶部 返回列表