Skip to content

Commit b172e05

Browse files
committed
clang linted
1 parent 5236bd0 commit b172e05

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

greedy_algorithms/binary_addition.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
* calculates the sum. If the sum exceeds 1, a carry is generated for the next
1010
* bit. The results for each bit are collected in a result string, which is
1111
* reversed at the end to present the final binary sum correctly. Additionally,
12-
* the function validates the input to ensure that only valid binary strings
13-
* (containing only '0' and '1') are processed. If invalid input is detected,
12+
* the function validates the input to ensure that only valid binary strings
13+
* (containing only '0' and '1') are processed. If invalid input is detected,
1414
* it returns an empty string.
1515
* @author [Muhammad Junaid Khalid](https://github.com/mjk22071998)
1616
*/
@@ -35,12 +35,13 @@ class BinaryAddition {
3535
*
3636
* @param a The first binary string.
3737
* @param b The second binary string.
38-
* @return The sum of the two binary strings as a binary string, or an empty string
39-
* if either input string contains non-binary characters.
38+
* @return The sum of the two binary strings as a binary string, or an empty
39+
* string if either input string contains non-binary characters.
4040
*/
4141
std::string addBinary(const std::string& a, const std::string& b) {
4242
if (!isValidBinaryString(a) || !isValidBinaryString(b)) {
43-
return ""; // Return empty string if input contains non-binary characters
43+
return ""; // Return empty string if input contains non-binary
44+
// characters
4445
}
4546

4647
std::string result;
@@ -73,9 +74,8 @@ class BinaryAddition {
7374
* @return true if the string is binary, false otherwise.
7475
*/
7576
bool isValidBinaryString(const std::string& str) const {
76-
return std::all_of(str.begin(), str.end(), [](char c) {
77-
return c == '0' || c == '1';
78-
});
77+
return std::all_of(str.begin(), str.end(),
78+
[](char c) { return c == '0' || c == '1'; });
7979
}
8080
};
8181
} // namespace greedy_algorithms

0 commit comments

Comments
 (0)