-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
fmdb
committed
Apr 21, 2019
1 parent
d7b1c51
commit ab71ef7
Showing
9 changed files
with
385 additions
and
1 deletion.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
281 changes: 281 additions & 0 deletions
281
leetcode/链表/203_linkedlistremove/203_linkedlistremove.xcodeproj/project.pbxproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,281 @@ | ||
// !$*UTF8*$! | ||
{ | ||
archiveVersion = 1; | ||
classes = { | ||
}; | ||
objectVersion = 50; | ||
objects = { | ||
|
||
/* Begin PBXBuildFile section */ | ||
24C749CA226C810600B77934 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 24C749C9226C810600B77934 /* main.cpp */; }; | ||
/* End PBXBuildFile section */ | ||
|
||
/* Begin PBXCopyFilesBuildPhase section */ | ||
24C749C4226C810600B77934 /* CopyFiles */ = { | ||
isa = PBXCopyFilesBuildPhase; | ||
buildActionMask = 2147483647; | ||
dstPath = /usr/share/man/man1/; | ||
dstSubfolderSpec = 0; | ||
files = ( | ||
); | ||
runOnlyForDeploymentPostprocessing = 1; | ||
}; | ||
/* End PBXCopyFilesBuildPhase section */ | ||
|
||
/* Begin PBXFileReference section */ | ||
24C749C6226C810600B77934 /* 203_linkedlistremove */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = 203_linkedlistremove; sourceTree = BUILT_PRODUCTS_DIR; }; | ||
24C749C9226C810600B77934 /* main.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = "<group>"; }; | ||
24C749D1226C822D00B77934 /* Solution.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = Solution.hpp; sourceTree = "<group>"; }; | ||
/* End PBXFileReference section */ | ||
|
||
/* Begin PBXFrameworksBuildPhase section */ | ||
24C749C3226C810600B77934 /* Frameworks */ = { | ||
isa = PBXFrameworksBuildPhase; | ||
buildActionMask = 2147483647; | ||
files = ( | ||
); | ||
runOnlyForDeploymentPostprocessing = 0; | ||
}; | ||
/* End PBXFrameworksBuildPhase section */ | ||
|
||
/* Begin PBXGroup section */ | ||
24C749BD226C810600B77934 = { | ||
isa = PBXGroup; | ||
children = ( | ||
24C749C8226C810600B77934 /* 203_linkedlistremove */, | ||
24C749C7226C810600B77934 /* Products */, | ||
); | ||
sourceTree = "<group>"; | ||
}; | ||
24C749C7226C810600B77934 /* Products */ = { | ||
isa = PBXGroup; | ||
children = ( | ||
24C749C6226C810600B77934 /* 203_linkedlistremove */, | ||
); | ||
name = Products; | ||
sourceTree = "<group>"; | ||
}; | ||
24C749C8226C810600B77934 /* 203_linkedlistremove */ = { | ||
isa = PBXGroup; | ||
children = ( | ||
24C749C9226C810600B77934 /* main.cpp */, | ||
24C749D1226C822D00B77934 /* Solution.hpp */, | ||
); | ||
path = 203_linkedlistremove; | ||
sourceTree = "<group>"; | ||
}; | ||
/* End PBXGroup section */ | ||
|
||
/* Begin PBXNativeTarget section */ | ||
24C749C5226C810600B77934 /* 203_linkedlistremove */ = { | ||
isa = PBXNativeTarget; | ||
buildConfigurationList = 24C749CD226C810600B77934 /* Build configuration list for PBXNativeTarget "203_linkedlistremove" */; | ||
buildPhases = ( | ||
24C749C2226C810600B77934 /* Sources */, | ||
24C749C3226C810600B77934 /* Frameworks */, | ||
24C749C4226C810600B77934 /* CopyFiles */, | ||
); | ||
buildRules = ( | ||
); | ||
dependencies = ( | ||
); | ||
name = 203_linkedlistremove; | ||
productName = 203_linkedlistremove; | ||
productReference = 24C749C6226C810600B77934 /* 203_linkedlistremove */; | ||
productType = "com.apple.product-type.tool"; | ||
}; | ||
/* End PBXNativeTarget section */ | ||
|
||
/* Begin PBXProject section */ | ||
24C749BE226C810600B77934 /* Project object */ = { | ||
isa = PBXProject; | ||
attributes = { | ||
LastUpgradeCheck = 1010; | ||
ORGANIZATIONNAME = dzb; | ||
TargetAttributes = { | ||
24C749C5226C810600B77934 = { | ||
CreatedOnToolsVersion = 10.1; | ||
}; | ||
}; | ||
}; | ||
buildConfigurationList = 24C749C1226C810600B77934 /* Build configuration list for PBXProject "203_linkedlistremove" */; | ||
compatibilityVersion = "Xcode 9.3"; | ||
developmentRegion = en; | ||
hasScannedForEncodings = 0; | ||
knownRegions = ( | ||
en, | ||
); | ||
mainGroup = 24C749BD226C810600B77934; | ||
productRefGroup = 24C749C7226C810600B77934 /* Products */; | ||
projectDirPath = ""; | ||
projectRoot = ""; | ||
targets = ( | ||
24C749C5226C810600B77934 /* 203_linkedlistremove */, | ||
); | ||
}; | ||
/* End PBXProject section */ | ||
|
||
/* Begin PBXSourcesBuildPhase section */ | ||
24C749C2226C810600B77934 /* Sources */ = { | ||
isa = PBXSourcesBuildPhase; | ||
buildActionMask = 2147483647; | ||
files = ( | ||
24C749CA226C810600B77934 /* main.cpp in Sources */, | ||
); | ||
runOnlyForDeploymentPostprocessing = 0; | ||
}; | ||
/* End PBXSourcesBuildPhase section */ | ||
|
||
/* Begin XCBuildConfiguration section */ | ||
24C749CB226C810600B77934 /* Debug */ = { | ||
isa = XCBuildConfiguration; | ||
buildSettings = { | ||
ALWAYS_SEARCH_USER_PATHS = NO; | ||
CLANG_ANALYZER_NONNULL = YES; | ||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; | ||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; | ||
CLANG_CXX_LIBRARY = "libc++"; | ||
CLANG_ENABLE_MODULES = YES; | ||
CLANG_ENABLE_OBJC_ARC = YES; | ||
CLANG_ENABLE_OBJC_WEAK = YES; | ||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; | ||
CLANG_WARN_BOOL_CONVERSION = YES; | ||
CLANG_WARN_COMMA = YES; | ||
CLANG_WARN_CONSTANT_CONVERSION = YES; | ||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; | ||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; | ||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES; | ||
CLANG_WARN_EMPTY_BODY = YES; | ||
CLANG_WARN_ENUM_CONVERSION = YES; | ||
CLANG_WARN_INFINITE_RECURSION = YES; | ||
CLANG_WARN_INT_CONVERSION = YES; | ||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; | ||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; | ||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; | ||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; | ||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; | ||
CLANG_WARN_STRICT_PROTOTYPES = YES; | ||
CLANG_WARN_SUSPICIOUS_MOVE = YES; | ||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; | ||
CLANG_WARN_UNREACHABLE_CODE = YES; | ||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; | ||
CODE_SIGN_IDENTITY = "-"; | ||
COPY_PHASE_STRIP = NO; | ||
DEBUG_INFORMATION_FORMAT = dwarf; | ||
ENABLE_STRICT_OBJC_MSGSEND = YES; | ||
ENABLE_TESTABILITY = YES; | ||
GCC_C_LANGUAGE_STANDARD = gnu11; | ||
GCC_DYNAMIC_NO_PIC = NO; | ||
GCC_NO_COMMON_BLOCKS = YES; | ||
GCC_OPTIMIZATION_LEVEL = 0; | ||
GCC_PREPROCESSOR_DEFINITIONS = ( | ||
"DEBUG=1", | ||
"$(inherited)", | ||
); | ||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES; | ||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; | ||
GCC_WARN_UNDECLARED_SELECTOR = YES; | ||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; | ||
GCC_WARN_UNUSED_FUNCTION = YES; | ||
GCC_WARN_UNUSED_VARIABLE = YES; | ||
MACOSX_DEPLOYMENT_TARGET = 10.13; | ||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; | ||
MTL_FAST_MATH = YES; | ||
ONLY_ACTIVE_ARCH = YES; | ||
SDKROOT = macosx; | ||
}; | ||
name = Debug; | ||
}; | ||
24C749CC226C810600B77934 /* Release */ = { | ||
isa = XCBuildConfiguration; | ||
buildSettings = { | ||
ALWAYS_SEARCH_USER_PATHS = NO; | ||
CLANG_ANALYZER_NONNULL = YES; | ||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; | ||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; | ||
CLANG_CXX_LIBRARY = "libc++"; | ||
CLANG_ENABLE_MODULES = YES; | ||
CLANG_ENABLE_OBJC_ARC = YES; | ||
CLANG_ENABLE_OBJC_WEAK = YES; | ||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; | ||
CLANG_WARN_BOOL_CONVERSION = YES; | ||
CLANG_WARN_COMMA = YES; | ||
CLANG_WARN_CONSTANT_CONVERSION = YES; | ||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; | ||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; | ||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES; | ||
CLANG_WARN_EMPTY_BODY = YES; | ||
CLANG_WARN_ENUM_CONVERSION = YES; | ||
CLANG_WARN_INFINITE_RECURSION = YES; | ||
CLANG_WARN_INT_CONVERSION = YES; | ||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; | ||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; | ||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; | ||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; | ||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; | ||
CLANG_WARN_STRICT_PROTOTYPES = YES; | ||
CLANG_WARN_SUSPICIOUS_MOVE = YES; | ||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; | ||
CLANG_WARN_UNREACHABLE_CODE = YES; | ||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; | ||
CODE_SIGN_IDENTITY = "-"; | ||
COPY_PHASE_STRIP = NO; | ||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; | ||
ENABLE_NS_ASSERTIONS = NO; | ||
ENABLE_STRICT_OBJC_MSGSEND = YES; | ||
GCC_C_LANGUAGE_STANDARD = gnu11; | ||
GCC_NO_COMMON_BLOCKS = YES; | ||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES; | ||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; | ||
GCC_WARN_UNDECLARED_SELECTOR = YES; | ||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; | ||
GCC_WARN_UNUSED_FUNCTION = YES; | ||
GCC_WARN_UNUSED_VARIABLE = YES; | ||
MACOSX_DEPLOYMENT_TARGET = 10.13; | ||
MTL_ENABLE_DEBUG_INFO = NO; | ||
MTL_FAST_MATH = YES; | ||
SDKROOT = macosx; | ||
}; | ||
name = Release; | ||
}; | ||
24C749CE226C810600B77934 /* Debug */ = { | ||
isa = XCBuildConfiguration; | ||
buildSettings = { | ||
CODE_SIGN_STYLE = Automatic; | ||
PRODUCT_NAME = "$(TARGET_NAME)"; | ||
}; | ||
name = Debug; | ||
}; | ||
24C749CF226C810600B77934 /* Release */ = { | ||
isa = XCBuildConfiguration; | ||
buildSettings = { | ||
CODE_SIGN_STYLE = Automatic; | ||
PRODUCT_NAME = "$(TARGET_NAME)"; | ||
}; | ||
name = Release; | ||
}; | ||
/* End XCBuildConfiguration section */ | ||
|
||
/* Begin XCConfigurationList section */ | ||
24C749C1226C810600B77934 /* Build configuration list for PBXProject "203_linkedlistremove" */ = { | ||
isa = XCConfigurationList; | ||
buildConfigurations = ( | ||
24C749CB226C810600B77934 /* Debug */, | ||
24C749CC226C810600B77934 /* Release */, | ||
); | ||
defaultConfigurationIsVisible = 0; | ||
defaultConfigurationName = Release; | ||
}; | ||
24C749CD226C810600B77934 /* Build configuration list for PBXNativeTarget "203_linkedlistremove" */ = { | ||
isa = XCConfigurationList; | ||
buildConfigurations = ( | ||
24C749CE226C810600B77934 /* Debug */, | ||
24C749CF226C810600B77934 /* Release */, | ||
); | ||
defaultConfigurationIsVisible = 0; | ||
defaultConfigurationName = Release; | ||
}; | ||
/* End XCConfigurationList section */ | ||
}; | ||
rootObject = 24C749BE226C810600B77934 /* Project object */; | ||
} |
7 changes: 7 additions & 0 deletions
7
...kedlistremove/203_linkedlistremove.xcodeproj/project.xcworkspace/contents.xcworkspacedata
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
8 changes: 8 additions & 0 deletions
8
.../203_linkedlistremove.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>IDEDidComputeMac32BitWarning</key> | ||
<true/> | ||
</dict> | ||
</plist> |
71 changes: 71 additions & 0 deletions
71
leetcode/链表/203_linkedlistremove/203_linkedlistremove/Solution.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
// | ||
// Solution.hpp | ||
// 203_linkedlistremove | ||
// | ||
// Created by dzb on 2019/4/21. | ||
// Copyright © 2019年 dzb. All rights reserved. | ||
// | ||
|
||
#ifndef Solution_hpp | ||
#define Solution_hpp | ||
|
||
#include <stdio.h> | ||
|
||
class Solution { | ||
class ListNode { | ||
public: | ||
int val; | ||
ListNode *next; | ||
ListNode(int x) : val(x), next(NULL) {} | ||
}; | ||
public: | ||
ListNode *m_head; | ||
int m_size; | ||
Solution() { | ||
m_head = new Solution::ListNode(0); | ||
m_size = 0; | ||
} | ||
void add(int val) { | ||
add(val,m_size); | ||
} | ||
ListNode *node(int index) { | ||
Solution::ListNode *pFind = m_head->next; | ||
for (int i = 0; i<index; i++) { | ||
pFind = pFind->next; | ||
} | ||
return pFind; | ||
} | ||
void add(int val,int index) { | ||
if (index == 0) { | ||
Solution::ListNode *pFind = node(index); | ||
Solution::ListNode *cur = new Solution::ListNode(val); | ||
cur->next = pFind; | ||
m_head->next = cur; | ||
} else { | ||
//待添加节点的前一个节点 | ||
Solution::ListNode *pre = node(index-1); | ||
Solution::ListNode *cur = new Solution::ListNode(val); | ||
cur->next = pre->next; | ||
pre->next = cur; | ||
} | ||
m_size++; | ||
} | ||
|
||
int LinkedList<E>::indexOf(E element) { | ||
LinkedList::Node *cur = m_head->m_element; | ||
for (int i = 0; i<m_size; i++) { | ||
if (element == cur->m_element) { | ||
return i; | ||
} | ||
cur = cur->m_next; | ||
} | ||
return ELEMENT_NOT_FOUND; | ||
} | ||
|
||
ListNode* removeElements(ListNode* head, int val) { | ||
|
||
return m_head; | ||
} | ||
}; | ||
|
||
#endif /* Solution_hpp */ |
17 changes: 17 additions & 0 deletions
17
leetcode/链表/203_linkedlistremove/203_linkedlistremove/main.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// | ||
// main.cpp | ||
// 203_linkedlistremove | ||
// | ||
// Created by dzb on 2019/4/21. | ||
// Copyright © 2019年 dzb. All rights reserved. | ||
// | ||
|
||
#include <iostream> | ||
#include "Solution.hpp" | ||
|
||
|
||
int main(int argc, const char * argv[]) { | ||
|
||
|
||
return 0; | ||
} |