LeetCode(数据库)- Build the Equation

Posted 程序员牧码

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了LeetCode(数据库)- Build the Equation相关的知识,希望对你有一定的参考价值。

题目链接:点击打开链接

题目大意:略。

解题思路:注意 GROUP_CONCAT([DISTINCT] 连接字段 [Order BY ASC/DESC 排序字段] [Separator '分隔符'])。

AC 代码

WITH t AS(SELECT power, factor, CONCAT(IF(factor > 0, '+', '-'), ABS(factor), IF(power = 0, '', IF(power = 1, 'X', CONCAT('X^', power)))) equation FROM Terms)

SELECT CONCAT(GROUP_CONCAT(equation ORDER BY power DESC SEPARATOR ''), '=0') equation 
FROM t

以上是关于LeetCode(数据库)- Build the Equation的主要内容,如果未能解决你的问题,请参考以下文章

已解决:could not find the task ‘g++ build active file,leetcode算法ACM编译调试

LeetCode(数据库)- The Airport With the Most Traffic

Errors occurred during the build. Errors occurred during the build. Errors running builder 'Java

LeetCode(数据库)- The Category of Each Member in the Store

LeetCode(数据库)- The Number of Seniors and Juniors to Join the Company

LeetCode(数据库)- The Number of Seniors and Juniors to Join the Company