From 2c4ec28ef3e75e6cc907d0c6ca20ba7065466e6c Mon Sep 17 00:00:00 2001 From: Yubo Liu Date: Tue, 14 May 2019 00:56:21 -0700 Subject: [PATCH] 0937 bug fixed. --- 0937-Reorder-Log-File/cpp-0937/CMakeLists.txt | 2 +- 0937-Reorder-Log-File/cpp-0937/main2.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/0937-Reorder-Log-File/cpp-0937/CMakeLists.txt b/0937-Reorder-Log-File/cpp-0937/CMakeLists.txt index e2515be4..52a38668 100644 --- a/0937-Reorder-Log-File/cpp-0937/CMakeLists.txt +++ b/0937-Reorder-Log-File/cpp-0937/CMakeLists.txt @@ -3,4 +3,4 @@ project(A) set(CMAKE_CXX_STANDARD 14) -add_executable(A main.cpp main2.cpp) \ No newline at end of file +add_executable(A main2.cpp) \ No newline at end of file diff --git a/0937-Reorder-Log-File/cpp-0937/main2.cpp b/0937-Reorder-Log-File/cpp-0937/main2.cpp index 901e7e51..905b6545 100644 --- a/0937-Reorder-Log-File/cpp-0937/main2.cpp +++ b/0937-Reorder-Log-File/cpp-0937/main2.cpp @@ -16,7 +16,7 @@ class Solution { public: vector reorderLogFiles(vector& logs) { - sort(logs.begin(), logs.end(), [](const string& log1, const string& log2) -> bool{ + stable_sort(logs.begin(), logs.end(), [](const string& log1, const string& log2) -> bool{ int space1 = log1.find(' '); string id1 = log1.substr(0, space1), after1 = log1.substr(space1 + 1);