日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

shopee虾皮科技测试工程师第一次笔试

發布時間:2023/12/10 编程问答 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 shopee虾皮科技测试工程师第一次笔试 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

10道單選題
10道多選題
2道編程題

第一題:十進制轉二進制計算1的個數(負數轉為補碼)

#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2021/8/23 15:44 # @Author : @linlianqin # @Site : # @File : 十進制轉換為二進制(計數1的個數).py # @Software: PyCharm # @description:class Solution:def oct_to_binary(self, input_int):# write code heretag = Trueif input_int == 0:return 0if input_int < 0:tag = Falseabs_int = abs(input_int)# 原碼bin_int = list(bin(abs_int)[2:])bin_int = ["0" for _ in range(32 - len(bin_int))] + bin_intif tag:return bin_int.count("1")else:# 反碼reverse_bin_int = ["0" for _ in range(32)]for index, i in enumerate(bin_int):if i == "0":reverse_bin_int[32-len(bin_int)+index] = "1"# 補碼res = ""resual = Truefor index,i in enumerate(reverse_bin_int[::-1]):if i == "0":if resual:res = "1"+reselse:res = "0"+resresual = Falseelif i == "1":if resual:res = "0" + resresual = Trueelse:res = "1" + resif resual:res = "1" + resreturn res.count("1")print(Solution().oct_to_binary(-5))

第二題:字符串轉為駝峰

#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2021/8/23 16:21 # @Author : @linlianqin # @Site : # @File : 輸入的字符串轉換為駝峰.py # @Software: PyCharm # @description: ''' 詳細描述 1. 轉換后的字符串只保留字母[a-zA-Z]和數字[0-9],去除其他字符; 2. 輸入字符串中的字母字符的前一字符如非字母或數字,該字母轉換后為大寫,如果前一個字符為字母或者數字,字母轉換后為小寫; 例外:轉換后的字符串第一個字符如果是字母,則該字母轉換后為小寫;——字符串首字母小寫 3. 轉換后的字符串保留數字字符。 4. 字符串如果為空或者無[a-zA-Z]和數字[0-9]中字符,請默認輸出如下字符串"shopee" '''class Solution:def camelCase(self, newString):# write code herestrLen = len(newString)# 字符串為空if strLen == 0:return "shopee"# 字符串不為空res = []for index,code in enumerate(newString):# 是字母或者數字if code.isalnum():if index == 0:if code.isdigit():res.append(code)else:res.append(code.lower())continue# 前一個是字母和數字時:if index >= 1 and newString[index-1].isalnum():if code.isdigit():res.append(code)else:res.append(code.lower())# 前一個不是字母和數字時elif index >= 1 and not newString[index - 1].isalnum():if code.isdigit():res.append(code)else:res.append(code.upper())#處理第一個字符if len(res) == 0:return "shopee"else:if res[0].isalpha():res[0] = res[0].lower()res = "".join(res)return resprint(Solution().camelCase("__HELLO_World"))

總結

以上是生活随笔為你收集整理的shopee虾皮科技测试工程师第一次笔试的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。