Skip to content

Commit 5aed716

Browse files
author
Carlos Leonard
committed
update
1 parent 6ee2408 commit 5aed716

29 files changed

+122
-71
lines changed
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

Debug/vc120.idb

0 Bytes
Binary file not shown.

Fun Practice.vcxproj

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010
<Platform>Win32</Platform>
1111
</ProjectConfiguration>
1212
</ItemGroup>
13-
<ItemGroup>
14-
<ClCompile Include="code16.cpp" />
15-
</ItemGroup>
1613
<PropertyGroup Label="Globals">
1714
<ProjectGuid>{48DF0788-2D72-474C-9946-5512D2A5D092}</ProjectGuid>
1815
<Keyword>Win32Proj</Keyword>

Fun Practice.vcxproj.filters

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,4 @@
1414
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
1515
</Filter>
1616
</ItemGroup>
17-
<ItemGroup>
18-
<ClCompile Include="code16.cpp">
19-
<Filter>Source Files</Filter>
20-
</ClCompile>
21-
</ItemGroup>
2217
</Project>

code1.cpp

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,37 +5,23 @@
55
using namespace std;
66

77
string FirstReverse(string str) {
8-
9-
/*string temp;
10-
int index = 0;
11-
int size = str.length()-1;
12-
13-
for (size; size >= 0; size--)
14-
{
15-
temp.push_back(str[size]);
16-
index++;
17-
}
18-
19-
return temp;*/
20-
21-
22-
// Better solution
8+
// Set placeholder string value to copy the original
239
string temp = str;
2410
int index = 0;
2511

12+
// Traverse the placeholder value backwards
13+
// At the same time edit the original in the backward iteration
2614
for (int x = temp.length()-1; x >= 0; x--)
2715
{
2816
str[index] = temp[x];
2917
index++;
3018
}
3119
return str;
32-
3320
}
3421

3522
int main() {
3623

3724
// keep this function call here
3825
cout << FirstReverse("coderbyte");
3926
return 0;
40-
4127
}

code10.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ string ABCheck(string str) {
3535
}
3636
}
3737

38-
3938
return "false";
40-
39+
// Note, looking back at code this could have been better simplified into a single condition
40+
// if (string[x] == 'a' && and string[x+4] == 'b') return true it would also be vice versa for the b character
4141
}
4242

4343
int main() {

code13.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ string ExOh(string str) {
99

1010
int xCount = 0, oCount = 0;
1111

12+
// Simple iteration to keep count on how many characters are either x or o
1213
for (int x = 0; x < str.length(); x++)
1314
{
1415
if (str[x] == 'x')

code14.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ string Palindrome(string str) {
1717
}
1818
int size = temp.length() - 1;
1919

20+
// Compare the new string by analyzing the characters from the front and back
2021
for (int x = 0; x < temp.length(); x++)
2122
{
2223
if (temp[x] != temp[size])

0 commit comments

Comments
 (0)