提交 9f67ad4a 编写于 作者: cosmicing's avatar cosmicing

已删除14-Queue/11-CreateCircularDeque/12-LinkQueue/CreateCircularDeque.cpp,...

已删除14-Queue/11-CreateCircularDeque/12-LinkQueue/CreateCircularDeque.cpp, 14-Queue/11-CreateCircularDeque/12-LinkQueue/Makefile
上级 db732f8b
#include<iostream>
#include<string>
#include<string.h>
#include<stack>
#include<assert.h>
using namespace std;
class MyCircularDeque {
public:
/** Initialize your data structure here. Set the size of the deque to be k. */
MyCircularDeque(int k) {
}
/** Adds an item at the front of Deque. Return true if the operation is successful. */
bool insertFront(int value) {
}
/** Adds an item at the rear of Deque. Return true if the operation is successful. */
bool insertLast(int value) {
}
/** Deletes an item from the front of Deque. Return true if the operation is successful. */
bool deleteFront() {
}
/** Deletes an item from the rear of Deque. Return true if the operation is successful. */
bool deleteLast() {
}
/** Get the front item from the deque. */
int getFront() {
}
/** Get the last item from the deque. */
int getRear() {
}
/** Checks whether the circular deque is empty or not. */
bool isEmpty() {
}
/** Checks whether the circular deque is full or not. */
bool isFull() {
}
};
/**
* Your MyCircularDeque object will be instantiated and called as such:
* MyCircularDeque* obj = new MyCircularDeque(k);
* bool param_1 = obj->insertFront(value);
* bool param_2 = obj->insertLast(value);
* bool param_3 = obj->deleteFront();
* bool param_4 = obj->deleteLast();
* int param_5 = obj->getFront();
* int param_6 = obj->getRear();
* bool param_7 = obj->isEmpty();
* bool param_8 = obj->isFull();
*/
string stringToString(string input) {
assert(input.length() >= 2);
string result;
for (int i = 1; i < input.length() -1; i++) {
char currentChar = input[i];
if (input[i] == '\\') {
char nextChar = input[i+1];
switch (nextChar) {
case '\"': result.push_back('\"'); break;
case '/' : result.push_back('/'); break;
case '\\': result.push_back('\\'); break;
case 'b' : result.push_back('\b'); break;
case 'f' : result.push_back('\f'); break;
case 'r' : result.push_back('\r'); break;
case 'n' : result.push_back('\n'); break;
case 't' : result.push_back('\t'); break;
default: break;
}
i++;
} else {
result.push_back(currentChar);
}
}
return result;
}
string boolToString(bool input) {
return input ? "True" : "False";
}
int main() {
string line;
while (getline(cin, line)) {
string s = stringToString(line);
string ret = Solution().removeDuplicateLetters(s);
string out = (ret);
cout << out << endl;
}
return 0;
}
CC := g++
#注意每行后面不要有空格,否则会算到目录名里面,导致问题
SRC_DIR = ./
BUILD_DIR = tmp
OBJ_DIR = $(BUILD_DIR)/obj
DEPS_DIR = $(BUILD_DIR)/deps
#这里添加其他头文件路径
INC_DIR = \
-I./include \
-I./src \
#这里添加编译参数
CC_FLAGS := $(INC_DIR) -g -std=c++11
LNK_FLAGS := \
-L/usr/local/lib
#这里递归遍历3级子目录
DIRS := $(shell find $(SRC_DIR) -maxdepth 3 -type d)
#将每个子目录添加到搜索路径
VPATH = $(DIRS)
#查找src_dir下面包含子目录的所有cpp文件
#SOURCES = $(foreach dir, $(DIRS), $(wildcard $(dir)/*.cpp))
SOURCES = CreateCircularDeque.cpp
OBJS = $(addprefix $(OBJ_DIR)/,$(patsubst %.cpp,%.o,$(notdir $(SOURCES))))
DEPS = $(addprefix $(DEPS_DIR)/, $(patsubst %.cpp,%.d,$(notdir $(SOURCES))))
TARGET := $(patsubst %.cpp, %, $(SOURCES))
$(TARGET):$(OBJS)
$(CC) $^ $(LNK_FLAGS) -o $@
#编译之前要创建OBJ目录,确保目录存在
$(OBJ_DIR)/%.o:%.cpp
if [ ! -d $(OBJ_DIR) ]; then mkdir -p $(OBJ_DIR); fi;\
$(CC) -c $(CC_FLAGS) -o $@ $<
#编译之前要创建DEPS目录,确保目录存在
#前面加@表示隐藏命令的执行打印
$(DEPS_DIR)/%.d:%.cpp
@if [ ! -d $(DEPS_DIR) ]; then mkdir -p $(DEPS_DIR); fi;\
set -e; rm -f $@;\
$(CC) -MM $(CC_FLAGS) $< > $@.$$$$;\
sed 's,\($*\)\.o[ :]*,$(OBJ_DIR)/\1.o $@ : ,g' < $@.$$$$ > $@;\
rm -f $@.$$$$
#前面加-表示忽略错误
-include $(DEPS)
.PHONY : clean
clean:
rm -rf $(BUILD_DIR) $(TARGET)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册