Skip to content
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

Merged
merged 14 commits into from
Jan 4, 2024
Merged

Homework #152

merged 14 commits into from
Jan 4, 2024

Conversation

yangxingye1
Copy link

Add leetcode later.

@iphysresearch
Copy link
Owner

Good Job!!! @yangxingye1

Python homework:

  • Total questions: 108
  • Correct answers: 103
  • Score: 95.00%

Numpy homework:

  • Total questions: 10
  • Correct answers: 10
  • Score: 100.00%

Pandas homework:

  • Total questions: 12
  • Correct answers: 10
  • Score: 83.00%

@iphysresearch
Copy link
Owner

Good Job!!! @yangxingye1

Python homework:

  • Total questions: 108
  • Correct answers: 103
  • Score: 95.00%

Numpy homework:

  • Total questions: 10
  • Correct answers: 10
  • Score: 100.00%

Pandas homework:

  • Total questions: 12
  • Correct answers: 10
  • Score: 83.00%

@iphysresearch
Copy link
Owner

Good Job!!! @yangxingye1

Python homework:

  • Total questions: 108
  • Correct answers: 103
  • Score: 95.00%

Numpy homework:

  • Total questions: 10
  • Correct answers: 10
  • Score: 100.00%

Pandas homework:

  • Total questions: 12
  • Correct answers: 11
  • Score: 91.00%

@iphysresearch
Copy link
Owner

Good Job!!! @yangxingye1

Python homework:

  • Total questions: 108
  • Correct answers: 103
  • Score: 95.00%

Numpy homework:

  • Total questions: 10
  • Correct answers: 10
  • Score: 100.00%

Pandas homework:

  • Total questions: 12
  • Correct answers: 11
  • Score: 91.00%

@iphysresearch
Copy link
Owner

Good Job!!! @yangxingye1

Python homework:

  • Total questions: 108
  • Correct answers: 103
  • Score: 95.00%

Numpy homework:

  • Total questions: 10
  • Correct answers: 10
  • Score: 100.00%

Pandas homework:

  • Total questions: 12
  • Correct answers: 11
  • Score: 91.00%

@iphysresearch
Copy link
Owner

Good Job!!! @yangxingye1

Python homework:

  • Total questions: 108
  • Correct answers: 103
  • Score: 95.00%

Numpy homework:

  • Total questions: 10
  • Correct answers: 10
  • Score: 100.00%

Pandas homework:

  • Total questions: 12
  • Correct answers: 12
  • Score: 100.00%

@iphysresearch
Copy link
Owner

Good Job!!! @yangxingye1

Python homework:

  • Total questions: 108
  • Correct answers: 103
  • Score: 95.00%

Numpy homework:

  • Total questions: 10
  • Correct answers: 10
  • Score: 100.00%

Pandas homework:

  • Total questions: 12
  • Correct answers: 12
  • Score: 100.00%

@yangxingye1
Copy link
Author

434. Number of Segments in a String

class Solution:
    def countSegments(self, s: str) -> int:
        return len(s.split())  #引用python的builtin函数

1869. Longer Contiguous Segments of Ones than Zeros

class 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 Ones

class Solution:
    def checkOnesSegment(self, s: str) -> bool:
        return '01' not in s  #开头是1,最多只有含1的一个片段,如果为false时字符串中会出现‘01’,因此需要判断这个

852. Peak Index in a Mountain Array

class 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 Element

class 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对应的是全部范围的极大值

@iphysresearch
Copy link
Owner

@yangxingye1
再努力一下把Python基础题目都做对哈?

@iphysresearch iphysresearch added this to the Leetcode HW finished milestone Dec 14, 2023
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@iphysresearch
Copy link
Owner

Good Job!!! @yangxingye1

Python homework:

  • Total questions: 108
  • Correct answers: 103
  • Score: 95.00%

Numpy homework:

  • Total questions: 10
  • Correct answers: 10
  • Score: 100.00%

Pandas homework:

  • Total questions: 12
  • Correct answers: 12
  • Score: 100.00%

@iphysresearch
Copy link
Owner

Good Job!!! @yangxingye1

Python homework:

  • Total questions: 108
  • Correct answers: 103
  • Score: 95.00%

Numpy homework:

  • Total questions: 10
  • Correct answers: 10
  • Score: 100.00%

Pandas homework:

  • Total questions: 12
  • Correct answers: 12
  • Score: 100.00%

@iphysresearch
Copy link
Owner

Good Job!!! @yangxingye1

Python homework:

  • Total questions: 108
  • Correct answers: 103
  • Score: 95.00%

Numpy homework:

  • Total questions: 10
  • Correct answers: 10
  • Score: 100.00%

Pandas homework:

  • Total questions: 12
  • Correct answers: 12
  • Score: 100.00%

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Matplotlib + Seaborn作业

@iphysresearch
Copy link
Owner

@yangxingye1
把Python基础作业都做完哈,然后我再给你录入成绩~

@iphysresearch
Copy link
Owner

Good Job!!! @yangxingye1

Python homework:

  • Total questions: 108
  • Correct answers: 108
  • Score: 100.00%

Numpy homework:

  • Total questions: 10
  • Correct answers: 10
  • Score: 100.00%

Pandas homework:

  • Total questions: 12
  • Correct answers: 12
  • Score: 100.00%

1 similar comment
@iphysresearch
Copy link
Owner

Good Job!!! @yangxingye1

Python homework:

  • Total questions: 108
  • Correct answers: 108
  • Score: 100.00%

Numpy homework:

  • Total questions: 10
  • Correct answers: 10
  • Score: 100.00%

Pandas homework:

  • Total questions: 12
  • Correct answers: 12
  • Score: 100.00%

@iphysresearch
Copy link
Owner

@yangxingye1
Sklearn 的建模作业再完善下?还有几个小时的时间~

Copy link
Owner

@iphysresearch iphysresearch left a 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建模作业!

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

好像建模作业都没有跑,后面似乎都还没写哈~~ @yangxingye1

@iphysresearch iphysresearch merged commit f4eb79a into iphysresearch:homework Jan 4, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants