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

Asana onsite

全局:

2022(4-6月) 码农类General 硕士 全职@ - Other - Onsite  | 😃 Positive 😐 Average | Pass | 在职跳槽

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

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

x
您好!
本帖隐藏的内容需要积分高于 150 才可浏览
您当前积分为 0。
使用VIP即刻解锁阅读权限或查看其他获取积分的方式
游客,您好!
本帖隐藏的内容需要积分高于 150 才可浏览
您当前积分为 0。
VIP即刻解锁阅读权限查看其他获取积分的方式
Unlock interview details and practice with AI
Curated Interview Questions from Top Companies

评分

参与人数 3大米 +12 收起 理由
Catheory91 + 1 Very helpful! Thanks for sharing!
michaelzju + 1 赞一个
匿名用户-JPMZA + 10

查看全部评分


上一篇:领英 onsite
下一篇:blaze debug轮
🔗
Catheory91 2022-10-15 08:31:13 | 只看该作者
全局:
Very helpful! Thanks for sharing!
回复

使用道具 举报

🔗
 楼主| Chasedream.df 2023-1-8 09:47:12 | 只看该作者
全局:
answer from chatgpt
  1. import sys

  2. class ASCIIPrinter:
  3.     def __init__(self):
  4.         # Initialize the canvas with spaces
  5.         self.canvas = [[' ' for _ in range(10)] for _ in range(6)]
  6.         # Initialize the list of rectangles
  7.         self.rectangles = []
  8.         
  9.     def draw_rectangle(self, fill_character, left_x, top_y, right_x, bottom_y):
  10.         # Add the rectangle to the list of rectangles
  11.         self.rectangles.append((fill_character, left_x, top_y, right_x, bottom_y))
  12.         # Draw the rectangle on the canvas
  13.         for i in range(top_y, bottom_y + 1):
  14.             for j in range(left_x, right_x + 1):
  15.                 self.canvas[i][j] = fill_character
  16.                
  17.         def drag_and_drop(self, select_x, select_y, release_x, release_y):
  18.         # Find the rectangle at the select coordinate
  19.         for i, rect in enumerate(self.rectangles):
  20.             if select_x >= rect[1] and select_x <= rect[3] and select_y >= rect[2] and select_y <= rect[4]:
  21.                 # Remove the rectangle from the list of rectangles
  22.                 rect = self.rectangles.pop(i)
  23.                 # Erase the rectangle from the canvas
  24.                 for i in range(rect[2], rect[4] + 1):
  25.                     for j in range(rect[1], rect[3] + 1):
  26.                         self.canvas[i][j] = ' '
  27.                 # Calculate the new left_x, top_y, right_x, and bottom_y of the rectangle
  28.                 left_x = min(select_x, release_x)
  29.                 top_y = min(select_y, release_y)
  30.                 right_x = max(select_x, release_x)
  31.                 bottom_y = max(select_y, release_y)
  32.                 # Add the rectangle to the list of rectangles
  33.                 self.rectangles.append((rect[0], left_x, top_y, right_x, bottom_y))
  34.                 # Draw the rectangle on the canvas
  35.                 for i

复制代码
回复

使用道具 举报

🔗
kate8528577 2023-3-4 07:15:14 | 只看该作者
全局:
ERASE_AREA之后的rectangle还是rectangle吗?还是变成了奇怪的形状?
回复

使用道具 举报

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

本版积分规则

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