Q: Why do you want to work as a software engineer at our company?

A: I admire your innovative tech solutions and collaborative culture. My skills in software development and passion for creating efficient code align perfectly with your company’s mission, and I’m eager to contribute to your team’s success.

Q: Can you describe your software development process?

A: I gather requirements, design architecture, develop, test, iterate based on feedback, and ensure high-quality deliverables through reviews and testing.

 

Principle: Red-Black Tree

Header: #include <map>

Methods: find(), count(), empty(), equal_rage()

Associated: std::next(), std::prev(), std::distance()

Feature: Map's key must be unique, multimap's key can be duplicated.

Code example:

#include "solution.hpp"
#include <iostream>
#include <map>

bool checkMultipleOccurrences(const std::string& fruit) {
    // Create a multimap with fruits as keys and their counts as values
    std::multimap<std::string, int> fruitMap = {
        {"apple", 5},
        {"banana", 2},
        {"apple", 3},
        {"orange", 4},
        {"apple", 4}
    };

    // TODO: Determine if the given fruit has multiple values and return true or false
    /*
    if (fruitMap.count(fruit) > 1) {
        return true;
    } else {
        return false;
    }
    */
    
    auto range = fruitMap.equal_range(fruit);
    if (std::distance(range.first, range.second) > 1) {
        return true;
    } else {
        return false;
    }
}

int main() {
    bool result = checkMultipleOccurrences("apple");
    if (result) {
        std::cout << "Multiple occurrences found." << std::endl;
    } else {
        std::cout << "No multiple occurrences." << std::endl;
    }
    return 0;
}
#include "solution.hpp"

std::map<std::string, int> count_event_frequency(const std::multimap<std::string, std::string>& events) {
    // TODO: Implement logic to return the frequency count of each date in the multimap.
    std::map<std::string, int> map;
    
    // multimap에서 꺼내서 map의 키를 검사 후 넣어
    for (const auto& event : events) {
        int count = map.count(event.first);
        if (map.count(event.first) != 0) {
            map.erase(event.first);
        }
        
        map.insert({event.first, count+1});   
    }
    
    return map;
}

int main() {
    // Create a multimap containing dates and their respective events
    std::multimap<std::string, std::string> events = {
        {"2023-06-11", "Seminar"},
        {"2023-06-11", "Workshop"},
        {"2023-06-21", "Concert"},
        {"2023-07-12", "Conference"},
        {"2023-07-12", "Meeting"}
    };

    // Get the frequency count of events on each date
    std::map<std::string, int> frequency_count = count_event_frequency(events);

    // Display the frequency count of events
    for (const auto& date : frequency_count) {
        std::cout << date.first << ": " << date.second << std::endl;
    }
    
    return 0;
}

 

 

'테크 > CodeSignal-C++' 카테고리의 다른 글

6. Browsing system for Deque  (0) 2024.11.30
5. Map using custom object key  (0) 2024.11.29
4. Multimap to Map  (0) 2024.11.28
2. Queue and Deque  (0) 2024.11.23
1. Stack  (0) 2024.11.23

경력: 8년

언어: C++(중급-고급), C# 4년(초급-중급), JAVA 1년(중급), JAVA Script 6개월(초급-중급), Shell Script 2년(초급-중급)

프레임워크: WPF (중급), Spring Boot (초급 - 중급)

OS: Windows, Ubuntu22.04, CentOS7, Rockylinux8.9

DB: Oracle11g -> 19c, PostgreSQL14

도구: Visual Studio, Visual Code, Git, GitLab, Jenkins, DBeaver, WSL, Docker + ELK or PG

OpenSource: ARIA, JSON

인프라 경험: AWS에 컨테이너 서비스 배포

수행 프로젝트: 인증 시스템 설계 및 개발, OOXML, WPF View, MachineID, ARIA, SentinelSDK DLL

Principle: FIFO (First In First Out)

Header: <queue>, <deque>

Methods: push(), pop(), front(), empty(), push_front(), push_back(), pop_front(), pop_back(), end(), rend()

Associated: std::rotate() - deque

Example:

In this exercise, you will develop a simple coffee shop order management system using a deque in C++. You will perform the following tasks:

Initialize a deque to manage coffee shop orders with initial drinks: 'Latte', 'Espresso', and 'Cappuccino'.
Add a new order 'Mocha' to the end of the deque.
Simulate a customer's change of mind by moving 'Latte' from the front to the back of the deque.
Serve (remove and print) the first order in the deque, which should be 'Espresso'.
Your goal is to demonstrate effective use of deque operations to simulate line management in a coffee shop.
#include "solution.hpp"

int main() {
    // TODO: Create a deque for coffee shop orders with initial orders 'Latte', 'Espresso', 'Cappuccino'
    std::deque<std::string> orders = {"Latte", "Espresso", "Cappuccino"};

    // TODO: A new customer orders a 'Mocha', add it to the end of the deque
    orders.push_back("Mocha");

    // TODO: A customer wants their 'Latte' order moved to the end of the deque. Implement it.
    std::rotate(orders.rbegin(), orders.rbegin()+1, orders.rend());

    // TODO: Process (remove and print) the first order in the deque. Which drink is it?
    std::string order = orders.front();
    orders.pop_front();
    std::cout << order << std::endl;
    
    return 0;
}

'테크 > CodeSignal-C++' 카테고리의 다른 글

6. Browsing system for Deque  (0) 2024.11.30
5. Map using custom object key  (0) 2024.11.29
4. Multimap to Map  (0) 2024.11.28
3. Map & Multimap  (0) 2024.11.26
1. Stack  (0) 2024.11.23

+ Recent posts