Skip to content

Commit edc7f05

Browse files
Upload new practice for char array.
1 parent 3493252 commit edc7f05

23 files changed

+195
-197
lines changed

06-1Dimensional Array/Easy/01-Is-The-Array-Increasing.cpp

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
/*
2-
# Created On 14/08/2024.
3-
# Code By: Hesham Z. Alsaqqaf.
4-
# Homework Easy [1] : Problem #1: Is The Array Increasing.
1+
/**
2+
* @version 0.1
3+
* @date 15/09/2024
4+
* @author Hesham Z. Alsaqqaf | [email protected].
5+
* @file Homework Easy [1]: Problem #1: Is The Array Increasing.
6+
*
7+
* @copyright Copyright (c) 2024
58
*/
69

710
#include <iostream>

06-1Dimensional Array/Easy/02-Replace MinMax.cpp

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
/*
2-
# Created On 12/09/2024.
3-
# Code By: Hesham Z. Alsaqqaf.
4-
# Homework Easy [2] : Problem #2: Replace MinMax Numbers;
1+
/**
2+
* @version 0.1
3+
* @date 15/09/2024
4+
* @author Hesham Z. Alsaqqaf | [email protected].
5+
* @file Homework Easy [2]: Problem #2: Replace MinMax Numbers.
6+
*
7+
* @copyright Copyright (c) 2024
58
*/
69

710
#include <iostream>

06-1Dimensional Array/Easy/03-Unique Numbers Of An Ordered List.cpp

+7-8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
/**
2-
* @version 0.1
3-
* @date 15/09/2024
4-
* @author Hesham Z. Alsaqqaf.
5-
* @file 03-Unique Numbers Of An Ordered List.cpp
6-
* @details Homework Easy [3] : Problem #3: Unique Numbers Of An Ordered List..
7-
*
8-
* @copyright Copyright (c) 2024
9-
*/
2+
* @version 0.1
3+
* @date 15/09/2024
4+
* @author Hesham Z. Alsaqqaf | [email protected].
5+
* @file Homework Easy [3]: Problem #3: Unique Numbers Of An Ordered List.
6+
*
7+
* @copyright Copyright (c) 2024
8+
*/
109

1110
#include <iostream>
1211
using namespace std;

06-1Dimensional Array/Easy/04-Is It A Palindrome.cpp

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
/**
2-
* @version 0.1
3-
* @date 15/09/2024
4-
* @author Hesham Z. Alsaqqaf | [email protected].
5-
* @file Homework Easy [4] : Problem #4: Is It A Palindrome.
6-
* @details Description.
2+
* @version 0.1
3+
* @date 15/09/2024
4+
* @author Hesham Z. Alsaqqaf | [email protected].
5+
* @file Homework Easy [4]: Problem #4: Is It A Palindrome.
76
*
8-
* @copyright Copyright Programmer/Hesham (c) 2024.
7+
* @copyright Copyright (c) 2024.
98
*/
109

1110
#include <iostream>

06-1Dimensional Array/Easy/05-Smallest Pair.cpp

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
/**
2-
* @version 0.1
3-
* @date 15/09/2024
4-
* @author Hesham Z. Alsaqqaf | [email protected].
5-
* @file Homework Easy [5] : Problem #: Smallest Pair.
6-
* @details Description.
2+
* @version 0.1
3+
* @date 15/09/2024
4+
* @author Hesham Z. Alsaqqaf | [email protected].
5+
* @file Homework Easy [5]: Problem #5: Smallest Pair.
76
*
8-
* @copyright Copyright Programmer/Hesham (c) 2024.
7+
* @copyright Copyright (c) 2024.
98
*/
109

1110
#include <iostream>

06-1Dimensional Array/Practice_1/01-Find The Two Maximum Values1.cpp 06-1Dimensional Array/Practice 1/01-Find The Two Maximum Values1.cpp

+7-14
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,11 @@
11
/**
2-
* @version 0.1
3-
* @date 2024-09-1
4-
* @author Hesham Z. Alsaqqaf | [email protected].
5-
* @file Practice [1] : Practice #1 : Find First And 2nd Maximum Values.
6-
* @details Description.
7-
● Read an Integer N ( 2 <= N <= 200), then read N (distinct) integers.
8-
Find the maximum and 2nd maximum values
9-
● Input: 5 => 10 20 3 30 7 ⇒ Output 30 20
10-
○ 30 is the maximum in the array
11-
○ If we removed it, the next maximum is 20
12-
*
13-
* @copyright Copyright Programmer/Hesham (c) 2024.
14-
*/
15-
2+
* @version 0.1
3+
* @date 01/09/2024
4+
* @author Hesham Z. Alsaqqaf | [email protected].
5+
* @file Practice [1]: Practice #1: Find First And 2nd Maximum Values.
6+
*
7+
* @copyright Copyright (c) 2024.
8+
*/
169

1710
#include <iostream>
1811
using namespace std;

06-1Dimensional Array/Practice_1/01-Find The Two Maximum Values2.cpp 06-1Dimensional Array/Practice 1/01-Find The Two Maximum Values2.cpp

+8-13
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
11
/**
2-
* @version 0.2
3-
* @date 2024-09-1
4-
* @author Hesham Z. Alsaqqaf | [email protected].
5-
* @file Practice [1] : Practice #2 : Find First And 2nd Maximum Values.
6-
* @details Description.
7-
● Read an Integer N ( 2 <= N <= 200), then read N (distinct) integers.
8-
Find the maximum and 2nd maximum values
9-
● Input: 5 => 10 20 3 30 7 ⇒ Output 30 20
10-
○ 30 is the maximum in the array
11-
○ If we removed it, the next maximum is 20
12-
*
13-
* @copyright Copyright Programmer/Hesham (c) 2024.
14-
*/
2+
* @version 0.2
3+
* @date 01/09/2024
4+
* @author Hesham Z. Alsaqqaf | [email protected].
5+
* @file Practice [1]: Practice #1: Find First And 2nd Maximum Values.
6+
*
7+
* @copyright Copyright (c) 2024.
8+
*/
9+
1510
#include <iostream>
1611
using namespace std;
1712

06-1Dimensional Array/Practice_1/01-Find The Two Maximum Values3.cpp 06-1Dimensional Array/Practice 1/01-Find The Two Maximum Values3.cpp

+7-13
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
11
/**
2-
* @version 0.3
3-
* @date 2024-09-1
4-
* @author Hesham Z. Alsaqqaf | [email protected].
5-
* @file Practice [1] : Practice #3 : Find First And 2nd Maximum Values.
6-
* @details Description.
7-
● Read an Integer N ( 2 <= N <= 200), then read N (distinct) integers.
8-
Find the maximum and 2nd maximum values
9-
● Input: 5 => 10 20 3 30 7 ⇒ Output 30 20
10-
○ 30 is the maximum in the array
11-
○ If we removed it, the next maximum is 20
12-
*
13-
* @copyright Copyright Programmer/Hesham (c) 2024.
14-
*/
2+
* @version 0.3
3+
* @date 01/09/2024
4+
* @author Hesham Z. Alsaqqaf | [email protected].
5+
* @file Practice [1]: Practice #1: Find First And 2nd Maximum Values.
6+
*
7+
* @copyright Copyright (c) 2024.
8+
*/
159
#include <iostream>
1610
using namespace std;
1711

06-1Dimensional Array/Practice_1/01-Find The Two Maximum Values4.cpp 06-1Dimensional Array/Practice 1/01-Find The Two Maximum Values4.cpp

+7-13
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
11
/**
2-
* @version 0.4
3-
* @date 2024-09-1
4-
* @author Hesham Z. Alsaqqaf | [email protected].
5-
* @file Practice [1] : Practice #4 : Find First And 2nd Maximum Values.
6-
* @details Description.
7-
● Read an Integer N ( 2 <= N <= 200), then read N (distinct) integers.
8-
Find the maximum and 2nd maximum values
9-
● Input: 5 => 10 20 3 30 7 ⇒ Output 30 20
10-
○ 30 is the maximum in the array
11-
○ If we removed it, the next maximum is 20
12-
*
13-
* @copyright Copyright Programmer/Hesham (c) 2024.
14-
*/
2+
* @version 0.3
3+
* @date 01/09/2024
4+
* @author Hesham Z. Alsaqqaf | [email protected].
5+
* @file Practice [1]: Practice #1: Find First And 2nd Maximum Values.
6+
*
7+
* @copyright Copyright (c) 2024.
8+
*/
159
#include <iostream>
1610
using namespace std;
1711

06-1Dimensional Array/Practice_1/02-Find pair values of maximum sum.cpp 06-1Dimensional Array/Practice 1/02-Find pair values of maximum sum.cpp

+7-12
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
11
/**
2-
* @version 0.1
3-
* @date 2024-09-1
4-
* @author Hesham Z. Alsaqqaf | [email protected].
5-
* @file Practice [1] : Practice #2 : Find Pair Values Of Maximum Sum
6-
* @details Description.
7-
● Read an Integer N, then read N <= 200 (distinct) integers.
8-
Find a pair of numbers (e.g. 2 different indices) whose sum is maximum.
9-
● Input: 5 => 2 10 3 50 15 ⇒ 65 (from 50 + 15).
10-
*
11-
* @copyright Copyright Programmer/Hesham (c) 2024.
12-
*/
13-
2+
* @version 0.3
3+
* @date 01/09/2024
4+
* @author Hesham Z. Alsaqqaf | [email protected].
5+
* @file Practice [1]: Practice #2: Find Pair Values Of Maximum Sum.
6+
*
7+
* @copyright Copyright (c) 2024.
8+
*/
149
#include <iostream>
1510
using namespace std;
1611

06-1Dimensional Array/Practice_2/01-Reverse-in-place.cpp 06-1Dimensional Array/Practice 2/01-Reverse-In-Place.cpp

+7-20
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,11 @@
11
/**
2-
* @version 0.1
3-
* @date 2024-08-23
4-
* @author Hesham Z. Alsaqqaf | [email protected].
5-
* @file Practice [2] : Practice #1: Reverse In Place.
6-
* @details Description.
7-
● Read an Integer N, then read N <= 200 integers.
8-
○ In-place: Change the current array, don’t use 2 arrays
9-
● Simple idea: Iterate from the begin and end in same time
10-
○ Swap the 2 positions
11-
○ Do this tell the middle only
12-
● Let say array is 1 2 3 4 5 6 7 8
13-
○ Step 1: swap (1, 8) ⇒ 8 2 3 4 5 6 7 1
14-
○ Step 2: swap (2, 7) ⇒ 8 7 3 4 5 6 2 1
15-
○ Step 3: swap (3, 6) ⇒ 8 7 6 4 5 3 2 1
16-
○ Step 4: swap (4, 6) ⇒ 8 7 6 5 4 3 2 1
17-
■ Stop after n/2 steps
18-
*
19-
* @copyright Copyright Programmer/Hesham (c) 2024.
20-
*/
21-
2+
* @version 0.1
3+
* @date 23/08/2024
4+
* @author Hesham Z. Alsaqqaf | [email protected].
5+
* @file Practice [2]: Practice #1: Reverse In Place.
6+
*
7+
* @copyright Copyright (c) 2024.
8+
*/
229
#include <iostream>
2310
using namespace std;
2411

06-1Dimensional Array/Practice_2/02-Find-most-frequent-number.cpp 06-1Dimensional Array/Practice 2/02-Find Most Frequent Number.cpp

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/**
2+
* @version 0.1
3+
* @date 23/08/2024
4+
* @author Hesham Z. Alsaqqaf | [email protected].
5+
* @file Practice [2]: Practice #2: Find Most Frequent Number.
6+
*
7+
* @copyright Copyright (c) 2024.
8+
*/
9+
110
#include <iostream>
211
using namespace std;
312

@@ -7,7 +16,7 @@ int main() {
716

817
for (int i = 0; i < n; ++i)
918
cin >> number[i];
10-
19+
1120
int value{ 0 }, maxRepeat{ 0 };
1221
for (int i = 0; i < n; ++i) {
1322
int repeated = 0; // Count

06-1Dimensional Array/Practice_2/03-Find-most-frequent-number-faster.cpp 06-1Dimensional Array/Practice 2/03-Find Most Frequent Number Faster.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/**
2+
* @version 0.1
3+
* @date 23/08/2024
4+
* @author Hesham Z. Alsaqqaf | [email protected].
5+
* @file Practice [2]: Practice #3: Find Most Frequent Number Faster.
6+
*
7+
* @copyright Copyright (c) 2024.
8+
*/
9+
110
#include <iostream>
211
using namespace std;
312

07-Char Arrays/Easy/01-Is Prefix.cpp

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/**
2+
* @version 0.1
3+
* @date 16/09/2024
4+
* @author Hesham Z. Alsaqqaf.
5+
* @file Homework Easy [1] : Problem #1: Is Prefix
6+
*
7+
* @copyright Copyright (c) 2024
8+
*/
9+
10+
#include <iostream>
11+
using namespace std;
12+
13+
int main() {
14+
return 0;
15+
}

07-Char Arrays/Easy/02-Is Suffix.cpp

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/**
2+
* @version 0.1
3+
* @date 16/09/2024
4+
* @author Hesham Z. Alsaqqaf.
5+
* @file Homework Easy [2] : Problem #2: Is Suffix.
6+
*
7+
* @copyright Copyright (c) 2024
8+
*/
9+
10+
#include <iostream>
11+
using namespace std;
12+
13+
int main() {
14+
return 0;
15+
}

07-Char Arrays/Easy/Not-Problem-Level-Easy.txt

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/**
2+
* @version 0.1
3+
* @date 16/09/2024
4+
* @author Hesham Z. Alsaqqaf | [email protected].
5+
* @file Practice [1]: Problem #1: Concatenations Strings
6+
*
7+
* @copyright Copyright (c) 2024
8+
*/
9+
10+
#include <iostream>
11+
using namespace std;
12+
13+
int main() {
14+
string first, second;
15+
cout << "Enter Tow String : ";
16+
cin >> first >> second;
17+
18+
int maxSize = first.size();
19+
if (maxSize < second.size()) {
20+
maxSize = second.size();
21+
}
22+
23+
for (int i = 0; i < maxSize; ++i) {
24+
cout << first[i] << second[i];
25+
}
26+
return 0;
27+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/**
2+
* @version 0.1
3+
* @date 16/09/2024
4+
* @author Hesham Z. Alsaqqaf | [email protected].
5+
* @file Practice [1]: Problem #2: Letters Frequency.
6+
*
7+
* @copyright Copyright (c) 2024
8+
*/
9+
10+
#include <iostream>
11+
using namespace std;
12+
13+
int main() {
14+
string str;
15+
int frequency[26] = { 0 }; // Initialized By Zeros
16+
17+
cout << "Enter String : ";
18+
cin >> str;
19+
20+
for (int i = 0; i < str.size(); ++i) {
21+
frequency[str[i]]++;
22+
}
23+
for (int i = 'a'; i <= 'z'; ++i) {
24+
if (frequency[i]) {
25+
cout << (char)i << " " << frequency[i] << "\n";
26+
}
27+
}
28+
29+
return 0;
30+
}
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/**
2+
* @version 0.1
3+
* @date 16/09/2024
4+
* @author Hesham Z. Alsaqqaf | [email protected].
5+
* @file Practice [1]: Problem #3: Special String Mapping.
6+
*
7+
* @copyright Copyright (c) 2024
8+
*/
9+
10+
#include <iostream>
11+
using namespace std;
12+
13+
int main() {
14+
return 0;
15+
}

0 commit comments

Comments
 (0)