tp.web.random_picture

2022-05-30

There is some self-interest behind every friendship. There is no friendship without self-interests. This is a bitter truth. — Chanakya

博客网站出现许多未被编入索引

see: https://www.yundianseo.com/currently-not-indexed-issue/

Two sum

Problem: https://www.code-recipe.com/post/two-sum

#include <iostream>
#include <vector>
#include <string>
#include <unordered_map>
#include <algorithm>
#include <stdlib.h>
#include <sstream>
 
using std::vector;
using std::unordered_map;
using std::cout;
using std::endl;
using std::string;
 
void PrintVec(const vector<int>& v)
{
    for (auto e : v)
    {
        cout << e << ' ';
    }
}
 
void HandleInput(vector<int>& array, int& target)
{
    while (true)
    {
        array.clear();
        cout << "Please input the array, separated by space:\n";
        string line;
        std::getline(std::cin, line);
        std::istringstream is(line);
        try {
            for (int val; is >> val; array.push_back(val)) {}
        }
        catch (std::exception())
        {
            continue;
        }
        break;
    }
    cout << "\nYou entered: ";
    PrintVec(array);
 
    cout << "Please input the target number:\n";
    std::cin >> target;
}
 
 
class Solution
{
public:
    static vector<int> TwoSum(const vector<int>& array, int target)
    {
        unordered_map<int, int> idx_map {};
        for (size_t i=0; i < array.size(); ++i)
        {
            int remainder = target - array[i];
            auto idx_iter = idx_map.find(remainder);
            if (idx_iter != idx_map.end())
                return vector<int>{static_cast<int>(i), idx_iter->second};
            else
                idx_map[array[i]] = i;
        }
        return vector<int>();
    }
};
 
 
int main()
{
 
    vector<int> array {7,2,13,11};
    int target = 9;
    HandleInput(array, target);
    auto ret = Solution::TwoSum(array, target);
 
    if (ret.empty())
        cout << "no answer.";
    else
        PrintVec(Solution::TwoSum(array, target));
 
    return 0;
}

本岗位主要负责蚂蚁海量数据访问、变更、灾备等所依托的数据中间件的设计和研发:

  1. 跨多个存储集群(DB、缓存和 OSS 等)数据访问代理中间件,具有分布式路由、弹性伸缩和容灾等能力;
  2. 跨DB、服务的高性能分布式事务中间件,包括维护开源项目Seata;
  3. 符合金融系统要求的数据、服务灾备机制与方案,如严格的数据安全性、业务正确性和业务连续性等;

本岗位P6/P7/P8均有需求,期待你的加入!

  1. 有三年以上的数据中间件、DB或存储系统研发经验;
  2. 熟练掌握 Java/C++/Go/Rust任意一种编程语言,掌握并发、网络编程和数据库编程;
  3. 对CAP、高可用架构、事务等理论有深入理解,并有一定的实践经验;
  4. 熟悉并具有Cobar、TDDL、Druid、Calcite等数据中间件开发经验者优先;
  5. 熟悉并具有XA、TCC等分布式事务框架或者解决方案经验者优先;
  6. 有技术热情和较强的学习能力,有很好的问题分析和技术攻关能力,有良好的团队合作和沟通能力。

职位要求: 1、具备扎实的数据结构、算法设计、设计模式、操作系统、网络编程等基础知识; 2、熟练使用c++基础语言进行研发,多线程、多进程、内存共享、网络通信编程技术; 3、熟悉实时流计算引擎或离线计算引擎,有对应的工程经验,例如:storm、hadoop、spark、flink等; 4、了解大规模、高并发、分布式系统设计,有相关开发经验优先; 5、了解机器学习和深度学习算法,有算法工程开发经验优先; 6、有搜索/推荐/广告系统和业务经验优先,具备良好的沟通和协作能力、持续的自驱力和较强的责任感。

职位要求参考