Git Product home page Git Product logo

algorithm_study's People

Contributors

365kim avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

doorahmie

algorithm_study's Issues

안녕하세요, 코드를 참고하다가 Overflow가 날 수 있는 부분을 발견하였습니다.

안녕하세요, 42-algorithm을 공부하고 있는 학생입니다.
Deque backjoon_1021 문제가 잘 풀리지않아서 고생을 해서 겨우 다 풀고나서,
365kim님의 코드가 이전부터 깔끔하다고 생각을 했었기 때문에 참고를 하기위해서 코드를 보았는데요
전역 변수로 int deque[300] 크기 300짜리 배열을 두셨는데, 이건 overflow날 수 있지 않나요?
deque_size를 50을 잡고, 중앙에 해당하는 값을 몇번 넣어서 한쪽방향으로만 숫자를 더해주게되면, 300의 크기를
쉽게 넘어갈수도 있을꺼 같습니다.

	while (find_size--)
	{
		scanf("%d", &target);
		count += get_route_length();
		printf("idx_front : %d\n",idx_front); // 이 부분을 추가해서 Debugging
	}
	printf("%d\n", count);

캡처_2020_06_06_21_58_04_810

365kim님의 code를 실행시켰을 때, 245 이후로 급격하게 idx front 값이 떨어지는 것이 확인 됩니다.
제 경우는 위 예시에서 220이 나옵니다.
어쩌다보니 제멋대로 코드리뷰(?)를 하게되었는데요. 도움이 되셨으면 좋겠습니다🙂

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.