Redian新闻
>
baseboard heating 是不是比较不efficient
avatar
baseboard heating 是不是比较不efficient# Living
j*n
1
1)给一个string,如何通过插入最少的字符使得它变成palindrome?

2) Given an integer, print the closest number to it that is a palindrome
input: 1224
return: 1221.
谁能给个链接,谢谢
avatar
n*e
2
看中一个1956年的房子,用的是baseboard oil heating, 是不是热房间会比较慢
,花费比较高?
谢谢了!
avatar
K*g
3
这还是老题啊?从没有见过这两题。我已经在这里混了2个多月了。。。

【在 j***n 的大作中提到】
: 1)给一个string,如何通过插入最少的字符使得它变成palindrome?
:
: 2) Given an integer, print the closest number to it that is a palindrome
: input: 1224
: return: 1221.
: 谁能给个链接,谢谢

avatar
g*9
4

No really, depending on the BTU output and the room size.
Cost is depending on your local price.

【在 n*******e 的大作中提到】
: 看中一个1956年的房子,用的是baseboard oil heating, 是不是热房间会比较慢
: ,花费比较高?
: 谢谢了!

avatar
K*g
5
第二题,感觉好像不难?
找到中间那个数字,假设是第i个,比较i+1和i-1位置的数字,如果相同,则比较i+2和
i-2,如果不同了,就把i-2的数字换成i+2的就行了?

【在 j***n 的大作中提到】
: 1)给一个string,如何通过插入最少的字符使得它变成palindrome?
:
: 2) Given an integer, print the closest number to it that is a palindrome
: input: 1224
: return: 1221.
: 谁能给个链接,谢谢

avatar
m*y
6
新一点的会用forced air 不过 这个pros/cons堆在一起 很难说哪个一定更好
买房子的话 一定focus在hard marker上 heating还不算是个hard marker
avatar
c*n
7

~~~~~~~~~~~~~~~~~~~~~~~i+2的换成i-2的吧?这样才是最接近的

【在 K******g 的大作中提到】
: 第二题,感觉好像不难?
: 找到中间那个数字,假设是第i个,比较i+1和i-1位置的数字,如果相同,则比较i+2和
: i-2,如果不同了,就把i-2的数字换成i+2的就行了?

avatar
R*Z
8
直接从两头比起不行吗?

【在 K******g 的大作中提到】
: 第二题,感觉好像不难?
: 找到中间那个数字,假设是第i个,比较i+1和i-1位置的数字,如果相同,则比较i+2和
: i-2,如果不同了,就把i-2的数字换成i+2的就行了?

avatar
b*u
9
还需要考虑有奇数个数字还是偶数个数字吧

【在 K******g 的大作中提到】
: 第二题,感觉好像不难?
: 找到中间那个数字,假设是第i个,比较i+1和i-1位置的数字,如果相同,则比较i+2和
: i-2,如果不同了,就把i-2的数字换成i+2的就行了?

avatar
c*f
10
哪里看到的题目?
avatar
j*n
11
第二题,输入1299. This should return 1331 and not 1221

【在 R***Z 的大作中提到】
: 直接从两头比起不行吗?
avatar
c*n
12
1是不是用DP?
I[i][j] = min # of char added to make substring from i to j become
palindrome
S[i][j] = the corresponding palindrome string converted from substring i to
j
then I[i][i]=0;I[i+1][i]=0
I[i][j] = min( I[i][j-1], I[i+1][j]) + 1 //if charAt[i] != charAt[j]
= I[i+1][j-1] //otherwise
S[i][j] modified accordingly
return S[0][N]

【在 j***n 的大作中提到】
: 1)给一个string,如何通过插入最少的字符使得它变成palindrome?
:
: 2) Given an integer, print the closest number to it that is a palindrome
: input: 1224
: return: 1221.
: 谁能给个链接,谢谢

avatar
j*n
13
嗯,这个是对的。还有一种做法是就longest common sequence of (s, reverse(s))

to

【在 c*********n 的大作中提到】
: 1是不是用DP?
: I[i][j] = min # of char added to make substring from i to j become
: palindrome
: S[i][j] = the corresponding palindrome string converted from substring i to
: j
: then I[i][i]=0;I[i+1][i]=0
: I[i][j] = min( I[i][j-1], I[i+1][j]) + 1 //if charAt[i] != charAt[j]
: = I[i+1][j-1] //otherwise
: S[i][j] modified accordingly
: return S[0][N]

avatar
r*o
14
LCS的方法怎么做啊?

【在 j***n 的大作中提到】
: 嗯,这个是对的。还有一种做法是就longest common sequence of (s, reverse(s))
:
: to

avatar
j*n
15
想了一下,求一个可能得到的Palindrome还是可行的。不过要是想求所有的可能的Pali
ndrome有没有什么优雅的解法?
举例:To make "RACE" into a palindrome, we must add at least three letters.
However, there are eight ways to do this by adding exactly three letters:
"ECARACE" "ECRARCE" "ERACARE" "ERCACRE"
"RACECAR" "RAECEAR" "REACAER" "RECACER"

【在 r****o 的大作中提到】
: LCS的方法怎么做啊?
avatar
c*n
16
用我之前那个方法,稍微该下就可以实现了,S存 a list of string,就可以了

Pali

【在 j***n 的大作中提到】
: 想了一下,求一个可能得到的Palindrome还是可行的。不过要是想求所有的可能的Pali
: ndrome有没有什么优雅的解法?
: 举例:To make "RACE" into a palindrome, we must add at least three letters.
: However, there are eight ways to do this by adding exactly three letters:
: "ECARACE" "ECRARCE" "ERACARE" "ERCACRE"
: "RACECAR" "RAECEAR" "REACAER" "RECACER"

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。