1. 平衡数,一些数字,其中某一个数的左边和和右边和相等,找到这个数的坐标,如果有多个则返回第一个(大概是这样,因为太简单所以没复制)
def GetIndex(nums):
n = len(nums)
if len(nums) <3:
return
for i in range(1,n-1):
if sum(nums[:i]) == sum(nums[i+1:]):
return i
2. 数的划分
https://blog.csdn.net/qq_38786209/article/details/80111311
3. XML字符串求取对象
示例:
"<people><name>shopee</name></people>","people.age"
解释:从前边提取出people.age,答案是“”
"<people><name>shopee</name></people>","people.name"
答案是"shopee"
100%通过答案:
class Solution:
def GetXMLValue(self, inxml, path) :
result = inxml.split("</")[0].replace("><",".")[1:].split(">")
if result[0] == path:
return result[1]
else:
return ""