-
Notifications
You must be signed in to change notification settings - Fork 153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Homework #152
Homework #152
Conversation
Good Job!!! @yangxingye1Python homework:
Numpy homework:
Pandas homework:
|
Good Job!!! @yangxingye1Python homework:
Numpy homework:
Pandas homework:
|
Good Job!!! @yangxingye1Python homework:
Numpy homework:
Pandas homework:
|
Good Job!!! @yangxingye1Python homework:
Numpy homework:
Pandas homework:
|
Good Job!!! @yangxingye1Python homework:
Numpy homework:
Pandas homework:
|
Good Job!!! @yangxingye1Python homework:
Numpy homework:
Pandas homework:
|
Good Job!!! @yangxingye1Python homework:
Numpy homework:
Pandas homework:
|
434. Number of Segments in a Stringclass Solution:
def countSegments(self, s: str) -> int:
return len(s.split()) #引用python的builtin函数 1869. Longer Contiguous Segments of Ones than Zerosclass Solution:
def checkZeroOnes(self, s: str) -> bool:
one_list = s.split("0") #按0分隔开
zero_list = s.split("1") #按1分隔开
one_max = max(one_list, key=len) #取1中长度最大的
zero_max = max(zero_list, key=len) #取0中长度最大的
return len(one_max) > len(zero_max) #比较字符串的长度 1784. Check if Binary String Has at Most One Segment of Onesclass Solution:
def checkOnesSegment(self, s: str) -> bool:
return '01' not in s #开头是1,最多只有含1的一个片段,如果为false时字符串中会出现‘01’,因此需要判断这个 852. Peak Index in a Mountain Arrayclass Solution:
def peakIndexInMountainArray(self, arr: List[int]) -> int:
l = 0 #初始化左边的index
r = len(arr) - 1 #初始化右边的index
while l < r:
m = (l+r) //2 #运用二分法,取除以2的整数部分
if arr[m] < arr[m+1]: #如果中间的左边小于右边,(m+1)赋值给左边
l = m+1
r = r
else: #如果中间的左边大于右边,m赋值给右边
l = l
r = m
return l #区间不断缩小,最后返回极值 162. Find Peak Elementclass Solution:
def findPeakElement(self, nums: List[int]) -> int:
i=0
j=len(nums)-1 #i, j取array的最左和最右的index
while(i<j):
mid=(i+j)//2 #取除以2后的整数部分
if(nums[mid]<nums[mid+1]): #中间相邻的两个数进行比较
i=mid+1 #当左边小于右边,相邻的数的右边作为新的i
else:
j=mid #当左边大于右边,相邻的数的左边作为新的j
return i #返回i的值,此时的index对应的是全部范围的极大值 |
@yangxingye1 |
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Good Job!!! @yangxingye1Python homework:
Numpy homework:
Pandas homework:
|
Good Job!!! @yangxingye1Python homework:
Numpy homework:
Pandas homework:
|
Good Job!!! @yangxingye1Python homework:
Numpy homework:
Pandas homework:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Matplotlib + Seaborn作业
@yangxingye1 |
Good Job!!! @yangxingye1Python homework:
Numpy homework:
Pandas homework:
|
1 similar comment
Good Job!!! @yangxingye1Python homework:
Numpy homework:
Pandas homework:
|
@yangxingye1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ljq2088
完成Python基础+拓展作业,Matplotlib+Seaborn数据可视化作业,Sklearn建模作业!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好像建模作业都没有跑,后面似乎都还没写哈~~ @yangxingye1
Add leetcode later.