CODE CLUB
MEETING ONE JAN 31 2024
WARMUP
Given a string s consisting of words and spaces, return the length of the last word in the string.
A word is a maximal substring consisting of non-space characters only.
Input: "Hello World"
Output: 5
Explanation: The last word is "World" with length 5.
Input: " fly me to the moon " Output: 4
Input: "luffy is still joyboy" Output: 6
LEETCODE PROBLEM #58
AGENDA
What do you want coding club to be about?
#1 Writing Code
Discussing the Foundations of Computer Science?
Making Games?
Learning Specific Languages?
AI? + 1
Telling Coding Related Jokes? + 1
Asking for Help With Code Related Projects + 1
MEETING TWO WED 7 2024
AGENDA
REVIEW LAST WEEK (5min)
WARMUP (30 min)
IDEAS FOR NEXT WEEK (25 min)
Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.
You may assume that each input would have exactly one solution, and you may not use the same element twice.
You can return the answer in any order.
Input: nums = [2,7,11,15], target = 9
Output: [0,1]
Explanation: Because nums[0] + nums[1] == 9, we return [0, 1].
LEETCODE #1
MEETING THREE WED Feb 21 2024
COLLECT CODE BASED PROJECTS (20 MINUTES)
WARMUP (10 min)
DISCUSS CODE FROM BEFORE (30 min)
https://leetcode.com/problems/length-of-last-word/description/
PROBLEM ONE
JAVA
PYTHON
class Solution
{
public int lengthOfLastWord(String s)
String[] ss = s.split(" ");
return ss[ss.length - 1].length();
}
class Solution(object):
def lengthOfLastWord(self, s):
#ss for substring
ss = s.strip().split(' ')
return len( ss[len(ss) - 1] )
PROBLEM TWO