摘要: 题目 自己尝试了好几次,才通过了 class Solution { public: vector<int> spiralOrder(vector<vector<int>>& matrix) { vector<int> ans; if (array.empty()) return ans; int x 阅读全文
posted @ 2024-11-16 20:07 hisun9 阅读(27) 评论(0) 推荐(0)
摘要: 问题 在写程序的时候遇到了这样一个问题,见代码 #include <iostream> #include <vector> using namespace std; bool isequal(vector<int> vshort, vector<int> vlong) { for (int inde 阅读全文
posted @ 2024-11-16 15:57 hisun9 阅读(45) 评论(0) 推荐(0)
摘要: std::stringstream 是 C++ 标准库中提供的一个类,定义在头文件 <sstream> 中。它是基于字符串的流(stream),允许像操作输入流(std::cin)或输出流(std::cout)那样,操作字符串内容。 std::stringstream 是 std::iostream 阅读全文
posted @ 2024-11-16 15:52 hisun9 阅读(387) 评论(0) 推荐(0)
摘要: 在 C++ 中,itoa 和 sprintf 是用于将数值转换为字符串的经典函数。然而,它们有一定的局限性或者安全性问题,现代 C++ 更倾向于使用标准库的解决方案,如 std::to_string 和 std::stringstream,来代替这些函数。 可以看看这篇博客 streamstring 阅读全文
posted @ 2024-11-16 15:48 hisun9 阅读(195) 评论(0) 推荐(0)
摘要: stoi 是 C++ 标准库中的一个函数,定义在头文件 <string> 中,它用于将字符串转换为整数类型。 函数原型 int stoi(const std::string& str, size_t* idx = 0, int base = 10); str(必选):要转换的字符串,必须以数字开头( 阅读全文
posted @ 2024-11-16 14:23 hisun9 阅读(1676) 评论(0) 推荐(0)