Skip to content
Navigation Menu
Sign in
Products
Platform
GitHub
Repository hosting, code review, and collaboration
Copilot
AI coding agent for tasks, projects, and automated work
Build & Ship
Actions
CI/CD and automation
Code Quality
Quality analysis, fixes, and enforcement
Codespaces
Cloud development environments
Secure
Code Security
Vulnerability detection and remediation
Secret Protection
Secret scanning and leak prevention
All Features
Developers
Learn
Documentation
Training
Certifications
Build
Build with Copilot
Customize Copilot
Integrations
Explore
Trending repos
GitHub Sponsors
Developer articles
Changelog
Changelog
Your source for the latest features, improvements, and fixes across GitHub products, all in one place.
Businesses
By Stage
Enterprises
Team
Startups
Nonprofits
By Industry
Healthcare
Financial services
Manufacturing
Government
See all industries
Evaluate GitHub
Why GitHub
Customer Stories
Business insights
Trust Center
Add-ons
GitHub Advanced Security
Enterprise-grade code security
Copilot for business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Resources
Learn & Connect
Documentation
Resource center
Blog
Events & webinars
Community Forum
Customer Stories
Integrations
Support
Customer support
Training
GitHub Status
Company
About
Partners
Changelog
GitHub Universe
GitHub Universe
The event for developers, by developers — talks, workshops, and what’s next for GitHub.
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
codeep
exercises
Repository navigation
Code
Issues
Pull requests
5
(5)
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
master
Breadcrumbs
exercises
/
array-and-strings.txt
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
62 lines (29 loc) · 1.46 KB
master
Breadcrumbs
exercises
/
array-and-strings.txt
Copy path
Top
File metadata and controls
Code
Blame
62 lines (29 loc) · 1.46 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
1) Given an array of strings and numbers. Print the number of integers and the number of strings in the array.
Input: [1, ‘10’, ‘hi’, 2, 3]
Output: “Numbers: 3, Strings: 2”
Input: [1, 4, ‘i am a string’, ‘456’]
Output: “Numbers: 2, Strings: 2”
Solution:
2) Write a function that accepts a string(a sentence) as a parameter and finds the longest word within the string․
If there are several words which are the longest ones, print the last word(words can be separated by space, comma or hyphen).
Input: “A revolution without dancing is a revolution not worth having.”
Output: "revolution"
Input: ”Which would be worse - to live as a monster, or to die as a good man?”
Output: "monster"
Solution:
3) Write a function which receives an array and a number as arguments and returns a new array from the elements of the given
array which are larger than the given number.
Input: "[10, 25, 16, -5, 30, 15, 24] , 16"
Output: "[25, 30, 24]"
Input: "[1, 1, 2, -3, 0, 8, 4, 0], 9"
Output: "[]"
Solution:
4) Write a function, which will receive a number between 0 to 999 and spell out that number in English.
Input: 5
Output: "five"
Input: 9425
Output: “nine thousand four hundred twenty five”
Solution:
5) A left rotation operation on an array shifts each of the array's elements unit to the left. For example,
if 2 left rotations are performed on array [1, 2, 3, 4, 5], then the array would become [3, 4, 5, 1, 2].
Solution:
You can’t perform that action at this time.